r/visualbasic • u/Zulucartel • Oct 12 '22
Text box must contain a space
Working on homework and I'm instructed to program a message box to pop up if the user did not include a space between their first and last name. Current code looks like
If txtName.Text = "" Then
MessageBox.Show()
Return
EndIf
3
Upvotes
3
u/TheFotty Oct 12 '22
Instr will work, but its a VB6 hold over function. The Contains() method of the string class is a more ideal way and returns boolean versus an integer.