22. Logical Operators
This tutorial will cover the Logical Operators in Visual Basic .NET. Similar to the conditional operators, logical operators are used to make a decision using words like “And” and “Or”. Logical operators can help you make a decision based on two or more factors.
Code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show("You didn't fill in the fields!")
End If
If TextBox1.Text = "thepassword" And TextBox2.Text = "thesecondpassword" Then
Form2.Show()
End If
End Sub
End Class
