Sunday 22 July 2012

conditional operators in vb.net

In This tutorial we 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 also called conditional checking operators.
                                                                                       
Copy and paste below 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

No comments:

Post a Comment