Aplikasi Windows Form Pada Visual Basic 2008
Sekilas tentang Windows Form
Dalam aplikasi pembuatan windows form unsur yang harus ada dalam sebuah windows form diantaranya:
Menu. menu mempunyai tujuan agar end user untuk mengakses perintah-perintah dan fungsi-fungsi high level dalam antarmuka yang familiar dan mudah dipahami.
Menu Pop-up. Menu pop-up ini memerlukan pemicu klik kanan jika agar dapat ditampilkan.
Tool Bar. Tool bar direpresentasikan oleh objek ToolBar, dan button-buton di dalamnya direpresentasikan oleh ToolBar Button.
MDI (Multiple Document Interface). MDI menyediakan metodologi untuk menyediakan antarmuka “document centric”. Salah satu keuntungan MDI adalah mereduksi clutter dan meningkatkan efisiensi penggunaan layar.
Contoh Program
Script Program
Public Class Form1
Private Sub popCut_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles PopCut.Click
If Me.RichTextBox1.SelectedText <> "" Then
Me.RichTextBox1.Cut()
End If
End Sub
Private Sub popCopy_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles PopCopy.Click
If Me.RichTextBox1.SelectedText <> "" Then
Me.RichTextBox1.Copy()
End If
End Sub
Private Sub popPaste_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles PopPaste.Click
Me.RichTextBox1.Paste()
End Sub
Private Sub popAll_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles PopAll.Click
Me.RichTextBox1.SelectAll()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End ClassHasil Program



Script
Program
Form 1
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If
TextBox1.Text = "arifin" And TextBox2.Text = "ipin"
Then
Form2.Show()
Me.Hide()
Else
MessageBox.Show("Sorry! Username and Password incorrect"
& vbCr & "Please Login again!")
End
End If
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
End
End Sub
End Class
Form 2
Public Class Form2
Dim i As Integer = 0
Private Sub mnuNew_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuNew.Click
i += 1
Dim
MDIChild As New
frmChild
MDIChild.MdiParent = Me
MDIChild.Text = " Window " & i
MDIChild.Show()
End Sub
Private Sub mnuHorizontally_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuHorizontally.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub mnuVertically_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuVertically.Click
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
Private Sub mnuCascade_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuCascade.Click
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private Sub mnuArrange_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuArrange.Click
Me.LayoutMdi(MdiLayout.ArrangeIcons)
End Sub
Private Sub mnuClose_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles mnuClose.Click
For Each ChildForm As
Form In Me.MdiChildren
ChildForm.Close()
Next
End Sub
Private Sub Timer1_Tick(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
ToolStripStatusLabel1.Text = "Ready " & TimeOfDay.Hour & ":" & TimeOfDay.Minute & ":" & TimeOfDay.Second
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End ClassHasil Program
Comments
Post a Comment