ANALISIS LISTING & FLOWCHART 2D & 3D
Pada form `1 tersedi sebuah combobox,
jika anda memilih persegi maka form 3 akan muncul, jika memilih persegi panjang
maka form 2 muncul dan seterusnya.
Form 2
Public Class Form2
Dim Luas As Integer
Dim sisi As Integer
Private Sub Form2_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load
Me.Text
= "Persegi Panjang"
Me.BackColor
= Color.BurlyWood
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
PictureBox1.Visible = False
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
Luas = sisi * sisi
TextBox3.Text = Luas
TextBox3.Text = TextBox1.Text *
TextBox2.Text
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
PictureBox1.Visible = True
PictureBox1.Width = TextBox1.Text * 2
PictureBox1.Height = TextBox2.Text * 2
End Sub
End Class
Pada form 2 adalah form tentang bangun persegi
panjang. Kami menggunakan picturebox untuk bentuknya kemudian size mode kami
ganti menjadi stretch image agar ukuran gambar bisa berubah.
Form
3
Public Class Form3
Dim Luas As Integer
Dim sisi As Integer
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
PictureBox1.Visible = False
End Sub
Private Sub Form3_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load
Me.Text
= "Persegi"
Me.BackColor
= Color.BurlyWood
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
Luas = sisi * sisi * sisi
TextBox3.Text = Luas
TextBox3.Text = TextBox1.Text *
TextBox2.Text
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox1.TextChanged
TextBox2.Text = TextBox1.Text
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
PictureBox1.Visible = True
PictureBox1.Width = TextBox2.Text * 2
PictureBox1.Height = TextBox1.Text * 2
End Sub
End Class
Sama seperti form 2 untuk bangun
kami menggunakan picturebox, tetapi karena ini persegi kami menambahkan listing
textbox2.text=textbox1.text agar apa yang dimasukkan ke textbox 1 akan tampil
juga pada textbox2.
Form4
Public Class Form4
Dim volum As Integer
Dim sisi As Integer
5
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
TextBox1.TextChanged
TextBox3.Text = TextBox1.Text
TextBox2.Text = TextBox1.Text
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
volum = sisi * sisi * sisi
TextBox4.Text = volum
TextBox4.Text = TextBox1.Text *
TextBox2.Text * TextBox3.Text
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
PictureBox1.Visible = False
End Sub
Private Sub Form4_Load(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
MyBase.Load
Me.Text
= "Kubus"
Me.BackColor
= Color.BurlyWood
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
PictureBox1.Visible = True
PictureBox1.Width = TextBox1.Text * 2
PictureBox1.Height = TextBox2.Text * 2
PictureBox1.Height = TextBox3.Text * 2
End Sub
End Class
Karena ini kubus maka harus ada
tiga sisi yang sama maka, listingnya adalah
TextBox3.Text = TextBox1.Text
TextBox2.Text = TextBox1.Text
Untuk mencari
volume digunakan rumus matematika sisi x sisi x sisi oleh karena itu listingnya
seperti ini TextBox4.Text
= TextBox1.Text * TextBox2.Text * TextBox3.Text
Form 5
Public Class Form5
Dim volum As Integer
Dim sisi As Integer
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
PictureBox1.Visible = False
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
volum = sisi * sisi * sisi
TextBox3.Text = volum
TextBox3.Text = TextBox1.Text *
TextBox2.Text * TextBox4.Text
End Sub
Private Sub Form5_Load(ByVal
sender As System.Object,
ByVal e As System.EventArgs) Handles
MyBase.Load
Me.Text
= "Balok"
Me.BackColor
= Color.BurlyWood
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button4.Click
PictureBox1.Visible = True
PictureBox1.Width = TextBox2.Text * 2
PictureBox1.Height = TextBox1.Text * 2
PictureBox1.Height = TextBox4.Text * 2
End Sub
End Class
Intinya sama seperti form 4,
tetapi dalam form ini kita harus mengisi textbox satu persatu, karena balok
memiliki sisi-sisi yang berbeda.