L16 - C2 Multiple Frames

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

L16_C2

MULTIPLE FRAMES
This lecture is about dealing with multiple frames. To add another frame,
the following simple steps can be used:
(1) Press Add New Item icon:

(2) Select Add Windows Form option:


(3) Simply select the Windows Form option and press the Add button in the
given window, as shown:
Example 1:

Public Class Form1

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles Button1.Click

Me.Hide()
Form2.Show()

End Sub

End Class

Public Class Form2

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal


e As System.EventArgs) Handles Button1.Click

Me.Hide()
Form3.Show()

End Sub

End Class
Public Class Form3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles Button1.Click

End

End Sub

End Class
……………………………

Example 2:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Timer1.Enabled = True

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value = ProgressBar1.Value + 1
Label1.Text = ProgressBar1.Value & " % " & "completed"
If ProgressBar1.Value >= 100 Then
Timer1.Enabled = False
If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
MsgBox(" Welcome " & TextBox1.Text, MsgBoxStyle.Information,
"Progressbar")
Me.Hide()
Form2.Show()
ProgressBar1.Value = 0
Label1.Text = ""
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
Else
MsgBox("Sorry username or password is incorrect",
MsgBoxStyle.Exclamation, "Progressbar")
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
ProgressBar1.Value = 0
Label1.Text = ""
End If
End If

End Sub
End Class

2.
1.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

If TextBox1.Text = "Ali" And TextBox2.Text = "aaaaaa" Then

MsgBox("Welcome to program", MsgBoxStyle.OkOnly + vbInformation,


"Correct")

Me.BackColor = Color.Green

Else

MsgBox("Wrong try again", vbCritical + vbOKOnly, "Wrong")

End If

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load

TextBox1.Text = ""

TextBox2.Text = ""

TextBox2.PasswordChar = "*"

Button1.Text = "Test"

End Sub

You might also like