The input dialog step will be multiple choice and allow the user to choose the day of the week. The next step would be an If step and would go either to “then” or “else” depending on their option. For the If step, i’m selecting the variable that’s the output of the input dialog step. When trying to plug that variable into the If step into the condition (Day = string.Format(“Monday”)), it gives me the error “Option Strict On disallows operands of type Object for operator ‘=’. Use the ‘Is’ operator to test for object identity.” I tried using Is, but that only gives me either true or false, but i need 5 options for each work day.
Hi!
The issue is in the condition you set Day = string.Format(“Monday”).
The value “Day” from the input Dialog is an Object, but you are trying to compare it to a String “Monday”. VB.NET doesn’t allow comparing different types when Option Strict On is enabled.
- I would try converting the Object to string when comparing, like so:
Day.ToString = "Monday" - Since you are working with 5 known options, it’s cleaner to use Switch activity instead of multiple Ifs. It would check Day.ToString and then run the macthing case only.
Hope this helps!
The if step works with your suggestion. I also converted it to the switch step and that works as well. thank you!
@charlotte.e
Use switch activity :
Expression: dayOfWeek.ToString
Cases: “Monday”, “Tuesday”, …
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
