Reputation: 93
I'm trying to check the following conditions in my if statement. However even when the conditions are met, the code under the if statement doesn't execute.
If (Gnum(0, 0) = Rnum(0, 0) & Gnum(0, 1) = Rnum(0, 1) & Gnum(0, 2) = Rnum(0, 2)) Then
Lbl_Msg.Text = "Send Msg"
End If
Upvotes: 1
Views: 297
Reputation: 7244
If (Gnum(0, 0) = Rnum(0, 0) AND Gnum(0, 1) = Rnum(0, 1) AND Gnum(0, 2) = Rnum(0, 2)) Then
Lbl_Msg.Text = "Send Msg"
Else
Lbl_Msg.Text = "see if this text is written to confirm if your if is true"
End If
Upvotes: 0
Reputation: 69372
Presumably you want to do AND
checks. Instead of &
, try using AndAlso
If (Gnum(0, 0) = Rnum(0, 0) AndAlso Gnum(0, 1) = Rnum(0, 1) AndAlso Gnum(0, 2) = Rnum(0, 2)) Then
Lbl_Msg.Text = "Send Msg"
end if
&
is used to concatenate strings in VB.NET.
Upvotes: 2
Reputation: 1501
I'm not certain if '&' will work as intended here as '&' is for concatenation in vb.net
Try using 'and' instead.
Edit: what vb.net thinks you're trying to do here is concatenating all those variables and checking whether or not that result is equal to true (which it is not going to be). That's why the code inside the if statement is not being executed but also no error is being shown.
Upvotes: 3