Forms in Visual Basic

Write the code below for the OK button on the Login Form. Notice that some code was already written. Read the Todo note for additional ideas about how to use the login form.

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
  If Me.UsernameTextBox.Text = "Joe" And Me.PasswordTextBox.Text = "password" Then
  End If
End Sub 'OK_Click

When you run the program the Splash Screen will show first. When you click on the Splash Screen Form1 will show.

MDI: Multiple Document Interface

An MDI form is similar to Word. In word, you can have several documents open at the same time within one "parent" form. When you click "new" you get a blank document that you can type in. In this project we will use a MDI parent form to display pictures in several "child" forms.

  1. Save any open project and start a new project named Pictures.
  2. On Form1, add a picture box and name it Pic.
  3. Set the SizeMode property of Pic to AutoSize.
  4. Set the location to 0,0
  5. From the menu select Project, Add Windows Form and select MDI Parent form.
  6. In the project properties window select start up from MDIParent1, as we did in the previous example.
  7. Run the program.
  8. Click New from the menu and a new form will appear, but it is not an instance of Form1 with the picture box.

NEXT: MDI Multiple Documents