i need to check if my textbox doesn't contain specific string "Fold". I used to do this like this
if (textbox.Text.Contains("Fold"){}
else { do stuff }
but now i need some alternative of this.
i need to check if my textbox doesn't contain specific string "Fold". I used to do this like this
if (textbox.Text.Contains("Fold"){}
else { do stuff }
but now i need some alternative of this.
You need to reverse the boolean:
if (!textBox.Text.Contains("Fold")) { ... }
Or you can compare with false
as @adv12 said:
if (textBox.Text.Contains("Fold") == false) { ... }
Thanks to adv12 i found this piece of code to work perfectly
if (textBox.Text.Contains("Fold")==false)
or
if (!textBox.Text.Contains("Fold"))
Please use !textbox.Text.Contains("Fold") the exclamation mark means 'not'.
You can get in a real time using TextChanged event of the TextBox. Much better way before users submits their result.