Senin, 27 Oktober 2014

MDI dan Menustrip

MDI dan Menustrip
(tugas 6 Lab VB2)



  1. Buat project baru pada MS Visual Studio dengan bahasa VB
  2. Tambahkan MDI form dengan klik kanan pada project > add > New Item > pilih MDI Parent Form







3.  Kemudian isi menu strip yang ada di MDI Parent Form, beri nama “Data Karyawan”, “ Data Pelanggan”, “Perhitungan Premi”. Nama menu tool strip dapat di sesuaikan dengan kebutuhan user.



Source code pada tool strip menu “Data Karyawan”

Private Sub ProjectToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProjectToolStripMenuItem.Click
' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.
ChildForm.MdiParent = Me

m_ChildFormNumber += 1
ChildForm.Text = "Data Karyawan " & m_ChildFormNumber

ChildForm.Show()
End Sub


Source code pada tool strip menu “Data Pelanggan”

Private Sub DataPelangganToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataPelangganToolStripMenuItem.Click
' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.
ChildForm.MdiParent = Me

m_ChildFormNumber += 1
ChildForm.Text = "Data Pelanggan " & m_ChildFormNumber

ChildForm.Show()
End Sub

Source code pada tool strip menu “Perhitungan Premi”

Private Sub PerhitunganPremiToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PerhitunganPremiToolStripMenuItem.Click
' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.
ChildForm.MdiParent = Me

m_ChildFormNumber += 1
ChildForm.Text = "Perhitungan Premi " & m_ChildFormNumber

ChildForm.Show()
End Sub

4.  Output saat debug ketika kita pilih/klik dari form MDI Parent "Data Karyawan", "Data Pelanggan", "Perhitungan Premi" adalah seperti ini,











Dosen Pembimbing : Agus Suharto M.Kom.
Oleh :