Prakash Murugan Prakash Murugan - 15 days ago 6
Vb.net Question

I can't use the underscore (_) to break the if statement in vb.net

If T_ANAME.Text = "" Or R_MALE.Checked = False Or R_FEMALE.Checked = False Or R_OTHERS.Checked = False _

Or (C_COUNTRY.Text = "-- Select Country --") _ Then

End If


This code shows syntax error.

I referred this page too
If Statement With Multiple Lines

Answer

Remove the extra _ at the end of the logical statement.

If T_ANAME.Text = "" Or R_MALE.Checked = False Or R_FEMALE.Checked = False Or R_OTHERS.Checked = False _
Or (C_COUNTRY.Text = "-- Select Country --") Then
' do something 
End If