Praktikum Hari Pertama :
PublicClass Form1
PrivateSub
cmdTampil_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
cmdTampil.Click
Dim pilihan AsString
pilihan = "Anda
memilih"
If
RbSate.Checked = TrueThen
pilihan = pilihan + "Sate"
Else
EndIf
If
RbSoto.Checked = TrueThen
pilihan = pilihan + "Soto"
Else
EndIf
If
Rbgadogado.Checked = TrueThen
pilihan = pilihan + "gado-gado"
Else
EndIf
MsgBox(pilihan)
EndSub
EndClass
PublicClass Form2
PrivateSub
cmdTampil_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
cmdTampil.Click
Dim pilihan AsString
pilihan = "Anda
memilih"
If
chbsate.Checked = TrueThen
pilihan = pilihan + " Sate"
Else
EndIf
If
chbSoto.Checked = TrueThen
pilihan = pilihan + " Soto"
Else
EndIf
If
chbGadogado.Checked = TrueThen
pilihan = pilihan + " gado-gado"
Else
EndIf
MsgBox(pilihan)
EndSub
EndClass
PublicClass Form3
PrivateSub
cmdTampil_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs)
EndSub
PrivateSub
cmdTampil_DoubleClick(ByVal sender AsObject, ByVal e As System.EventArgs)
EndSub
PrivateSub
LstList_DoubleClick(ByVal sender AsObject, ByVal e As System.EventArgs) Handles
LstList.DoubleClick
Dim pilihan AsString
pilihan = "Anda
memilih"
If
LstList.SelectedIndex = 0 Then
pilihan = pilihan + "Sate"
Else
EndIf
If
LstList.SelectedIndex = 1 Then
pilihan = pilihan + "Soto"
Else
EndIf
If
LstList.SelectedIndex = 2 Then
pilihan = pilihan + "gado-gado"
Else
EndIf
MsgBox(pilihan)
EndSub
PrivateSub
LstList_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
LstList.SelectedIndexChanged
EndSub
PrivateSub
cmdTambah_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnTambah.Click
LstList.Items.Add(txttambah.Text)
EndSub
PrivateSub
btnHapus_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnHapus.Click
LstList.Items.Remove(LstList.SelectedItem)
EndSub
PrivateSub
btnHapusSemua_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnHapusSemua.Click
LstList.Items.Clear()
EndSub
PrivateSub
Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
EndSub
PrivateSub
ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
EndSub
EndClass
PrivateSub
ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
cbbMakanan.SelectedIndexChanged
Dim pilihan AsString
pilihan = "Anda
memilih"
If
cbbMakanan.SelectedIndex = 0 Then
pilihan = pilihan + "Sate"
Else
EndIf
If
cbbMakanan.SelectedIndex = 1 Then
pilihan = pilihan + "Soto"
Else
EndIf
If
cbbMakanan.SelectedIndex = 2 Then
pilihan = pilihan + "gado-gado"
Else
EndIf
MsgBox(pilihan)
EndSub
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
If
Val(TextBox1.Text) < 0 Then
TextBox2.Text = "Bilangan negatif"
EndIf
If
Val(TextBox1.Text) > 0 Then
TextBox2.Text = "Bilangan positif"
EndIf
EndSub
PrivateSub
BtnHapus_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
BtnHapus.Click
TextBox1.Text = ""
TextBox2.Text = ""
EndSub
PrivateSub
Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
ListView1.Items.Add("Adi")
ListView1.Items(0).SubItems.Add("Manajemen")
ListView1.Items.Add("Rudi")
ListView1.Items(1).SubItems.Add("Manajemen")
ListView1.Items.Add("Dodi")
ListView1.Items(2).SubItems.Add("Manajemen")
ListView1.Items.Add("Jaka")
ListView1.Items(3).SubItems.Add("Manajemen")
EndSub
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
If
ListView1.SelectedItems.Count <> 0 Then
ListView1.Items.Remove(ListView1.SelectedItems(0))
Else
MsgBox("Anda
belum memilih item")
EndIf
EndSub
PrivateSub Button3_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
If
ListView1.SelectedItems.Count <> 0 Then
Dim namaitem AsString
namaitem =
ListView1.SelectedItems(0).Text
MsgBox("Anda
memilih "& namaitem &"")
Else
MsgBox("Anda
belum memilih ITem")
EndIf
EndSub
PrivateSub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
ListView1.Items.Clear()
Praktikum Hari ke 2 :
PERTEMUAN II
PrivateSub
Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
ListView1.Items.Add("Adi")
ListView1.Items(0).SubItems.Add("Manajemen")
ListView1.Items.Add("Rudi")
ListView1.Items(1).SubItems.Add("Manajemen")
ListView1.Items.Add("Dodi")
ListView1.Items(2).SubItems.Add("Manajemen")
ListView1.Items.Add("Jaka")
ListView1.Items(3).SubItems.Add("Manajemen")
EndSub
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
If
ListView1.SelectedItems.Count <> 0 Then
ListView1.Items.Remove(ListView1.SelectedItems(0))
Else
MsgBox("Anda
belum memilih item")
EndIf
EndSub
PrivateSub
Button3_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button3.Click
If
ListView1.SelectedItems.Count <> 0 Then
Dim namaitem AsString
namaitem =
ListView1.SelectedItems(0).Text
MsgBox("Anda
memilih "& namaitem &"")
Else
MsgBox("Anda
belum memilih ITem")
EndIf
EndSub
PrivateSub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
ListView1.Items.Clear()
EndSub
PrivateSub
Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
TreeView1.Nodes.Add("nama")
TreeView1.Nodes(0).Nodes.Add("Adi")
TreeView1.Nodes(0).Nodes.Add("Rudi")
TreeView1.Nodes.Add("Jurusan")
TreeView1.Nodes(1).Nodes.Add("Manajemen")
TreeView1.Nodes(1).Nodes.Add("Komputer")
EndSub
PrivateSub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
TreeView1.Nodes.Clear()
EndSub
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
TreeView1.Nodes.Remove(TreeView1.SelectedNode)
EndSub
PrivateSub
TreeView1_AfterExpand(ByVal sender AsObject, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterExpand
EndSub
PrivateSub
TreeView1_AfterSelect(ByVal sender AsObject, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim namaitem AsString
namaitem = TreeView1.SelectedNode.Text
MsgBox(namaitem)
EndSub
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim tgl AsDate
tgl = Format(DateTimePicker1.Value)
MsgBox(tgl)
EndSub
PrivateSub
Gambar1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Gambar1ToolStripMenuItem.Click
PictureBox1.ImageLocation = "d:\desert.jpg"
EndSub
PrivateSub
Gambar2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Gambar2ToolStripMenuItem.Click
PictureBox1.ImageLocation = "d:\chrysanthemum.jpg"
EndSub
PrivateSub
HilangkanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
HilangkanToolStripMenuItem.Click
If
HilangkanToolStripMenuItem.Checked = FalseThen
PictureBox1.Visible = True
Else
PictureBox1.Visible = False
EndIf
EndSub
PrivateSub
Tampilan1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Tampilan1ToolStripMenuItem.Click
PictureBox1.SizeMode =
PictureBoxSizeMode.Normal
EndSub
PrivateSub
Tampilan2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Tampilan2ToolStripMenuItem.Click
PictureBox1.SizeMode =
PictureBoxSizeMode.StretchImage
EndSub
PublicClass Form1
PrivateSub
TextBox1_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
TextBox1.TextChanged
If
Val(TextBox1.Text) = 0 Then
Label2.Text = "Nol"'Pernyataan-1
Else
If
Val(TextBox1.Text) = 1 Then
Label2.Text = "Satu"'Pernyataan-2
Else
If
Val(TextBox1.Text) = 2 Then
Label2.Text = "Dua"'Pernyataan-M1
Else
Label2.Text = "????"'Pernyataan-M2
EndIf
EndIf
EndIf
EndSub
EndClass
PublicClass Form1
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
Dim i AsInteger
For i = 1 To 10
ListBox1.Items.Add(i)
Next
EndSub
EndClass
PrivateSub
Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button1.Click
TextBox1.Text = Rnd().ToString
EndSub
PrivateSub
Button2_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Button2.Click
Randomize()
TextBox2.Text = Rnd().ToString
EndSub
EndClass
PublicClass Form1
PrivateSub
ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
ExitToolStripMenuItem.Click
Me.Dispose()
EndSub
PrivateSub
Form1_MouseDown(ByVal sender AsObject, ByVal e As System.Windows.Forms.MouseEventArgs) HandlesMe.MouseDown
If e.Button =
Windows.Forms.MouseButtons.Right Then
Me.ContextMenuStrip1.Show(Me, New Point(e.X,
e.Y))
EndIf
EndSub
EndClass