I am trying to create an if statement that will perform an action if any of the conditions are true. The items I need to test are the text values of eight textboxes. What I have right now is the following and the error it gives me says “Operator ‘||’ cannot be applied to operands of type ‘string’ and ‘string'”.
if (textbox1.text = "" || textbox2.text = "" || ...... and so on)
If anyone knows a how I am supposed to be wording this if statement or an easy way to check to see if a .ini file at a known location exists. Either would work for me.
You need to use the equality operator
==not the assignment=.Your
textbox1.text = ""sets the value oftextbox1.textto an empty string, and returns this as the result of the assignment. You are therefore attempting to use a boolean or (||) on two strings.