ANALISIS LISTING
Public Class Form1
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
If RadioButton1.Checked Then
Form2.Show()
End If
(pilih
radiobutton1 klik button1 akan muncul form2)
If RadioButton2.Checked Then
FORM3.SHOW()
End If
(pilih
radiobutton2 klik button1 akan muncul form3)
If RadioButton3.Checked Then
FORM4.SHOW()
End If
(pilih
radiobutton3 klik button1 akan muncul form4)
If RadioButton4.Checked Then
FORM5.SHOW()
End If
(pilih
radiobutton4 klik button1 akan muncul form5)
Me.Hide()
End Sub
(setelah
form2,3,4,5 aktif form 1 sembunyi)
Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
BackColor =
Color.Aqua
End Sub
(memberi warna pada background)
private sub
button2_click(byval sender as system.object, byval e as system.eventargs) handles
button2.click
me.close()
end sub
end class
(keluar dari form tersebut)
Public Class Form2
Dim SISI As Integer
Dim LUAS As Integer
Dim KELILING As Integer
(Dim
itu berarti menyatakan dan integer itu berarti bilangan bulat)
Private Sub
TextBox1_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk mengatur
supaya textbox dapat diisi hanya dengan angka)
Private Sub
TextBox2_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then
e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Private Sub
TextBox3_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
SISI =
Val(TextBox1.Text)
LUAS =
Val(SISI * SISI)
TextBox2.Text = LUAS
KELILING =
Val(4 * SISI)
TextBox3.Text = KELILING
(RUMUS LUAS DAN
KELILING DARI PERSEGI)
Dim myRect As New Rectangle
myRect.X =
20
myRect.Y =
20
myRect.Width = TextBox1.Text
myRect.Height = myRect.Width
Dim myPen As Pen
myPen = New Pen(Drawing.Color.Blue, 1)
Dim myGraphics As Graphics = Panel1.CreateGraphics
myGraphics.DrawRectangle(myPen, myRect)
(memberi perintah untuk menghitung luas, keliling dan
menggambar persegi yang sudah diatur di tabel sisi dengan ukuran mm)
If TextBox1.Text > 170 Then
MsgBox("terlalu besar")
Return
End If
(MEMBERI
PESAN KEPADA KITA)
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
(kembali ke form awal untuk memilih pilihan yang lain)
Private Sub
Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
Panel1.Refresh()
End Sub
(untuk menghapus apa yang sudah diisi agar diisi dengan
angka lain)
Private Sub
Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
BackColor =
Color.Aqua
End Sub
End Class
(MEMBERI
WARNA PADA BACKGROUND)
Public Class Form3
Dim PANJANG As Integer
Dim LEBAR As Integer
Dim LUAS As Integer
Dim KELILING As Integer
(Dim
itu berarti menyatakandan integer itu berarti bilangan bulat)
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
(UNTUK
MENJALANKAN FORM1 DAN FORM2 TERSEMBUNYI)
Private Sub
Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
BackColor =
Color.Aqua
End Sub
(MEMBERI
WARNA PADA BACKGROUND)
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
PANJANG =
Val(TextBox1.Text)
LEBAR =
Val(TextBox2.Text)
LUAS =
Val(PANJANG * LEBAR)
TextBox3.Text = LUAS
KELILING =
Val((2 * PANJANG) + (2 * LEBAR))
TextBox4.Text = KELILING
(RUMUS MENGHITUNG
LUAS KELILING PERSEGI PANJANG)
Dim myRect As New Rectangle
myRect.X =
20
myRect.Y =
20
myRect.Width = TextBox1.Text
myRect.Height = TextBox2.Text
Dim myPen As Pen
myPen = New Pen(Drawing.Color.Blue, 1)
Dim myGraphics As Graphics = Panel1.CreateGraphics
myGraphics.DrawRectangle(myPen, myRect)
(memberi perintah untuk menghitung luas ,keliling dan
menggambar persegi panjang sesuai angka yang ditentukan)
If TextBox1.Text > 500 And
TextBox2.Text > 190 Then
MsgBox("terlalu besar")
Panel1.Hide()
Return
End If
(MEMBERI
PESAN UNTUK KITA)
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 = ""
Panel1.Refresh()
End Sub
(MERESET ULANG
APA YANG SUDAH DIISI)
Private Sub
TextBox1_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Private Sub
TextBox2_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
End Class
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Public Class Form4
Dim SISI As Integer
Dim volume As Integer
Dim luas_permukaan As
Integer
(Dim
itu berarti menyatakandan integer itu berarti bilangan bulat)
Private Sub
Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
BackColor =
Color.Aqua
End Sub
(MEMBERI WARNA
BACKGROUND)
Private Sub
Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button3.Click
TextBox1.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Panel1.Refresh()
End Sub
(MERESET ULANG
APA YANG SUDAH DIISI)
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
(FORM1
AKTIF , FORM INI SENDIRI TERSEMBUNYI)
Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim s = TextBox1.Text
TextBox3.Text = s ^ 3
TextBox4.Text
= (6 * (s * s))
(RUMUS VOLUME DAN
LUAS PERMUKAAN)
If s = ""
Then
MsgBox("tolong input data yg diperlukan", MsgBoxStyle.Critical)
End If
(MEMBUAT PESAN)
Dim myGraphics As Graphics = Panel1.CreateGraphics
Dim myPen As Pen
myPen = New Pen(Drawing.Color.BlueViolet, 3)
Dim x1 As New Integer
Dim x2 As New Integer
Dim y1 As New Integer
Dim y2 As New Integer
Dim width As New Integer
Dim height As New Integer
Dim myRect As New Rectangle
width =
TextBox1.Text
height =
TextBox1.Text
myRect.Width = TextBox1.Text
myRect.Height = TextBox1.Text
myRect.X =
10
myRect.Y =
(10 + width / 2)
myGraphics.DrawRectangle(myPen,
myRect)
myRect.X =
(10 + width / 2)
myRect.Y =
10
myGraphics.DrawRectangle(myPen, myRect)
x1 = 10
y1 = (10 +
width / 2)
x2 = (10 +
width / 2)
y2 = 10
myGraphics.DrawLine(myPen, x1, y1, x2, y2)
y1 = y1 +
width
y2 = y2 +
width
myGraphics.DrawLine(myPen, x1, y1, x2, y2)
x1 = x1 +
width
x2 = x2 +
width
myGraphics.DrawLine(myPen, x1, y1, x2, y2)
y1 = y1 -
width
y2 = y2 - width
myGraphics.DrawLine(myPen, x1, y1, x2, y2)
(memberi perintah untuk menghitung volume, luas permukaan
dan menggambar kubus sesuai dengan apa yang diinginkan)
If TextBox1.Text > 200 Then
MsgBox("terlalu besar")
TextBox1.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Return
End If
(MERESET
ULANG DATAYANG SUDAH DIISI UNTUK DIISI DENGAN DATA LAIN)
End Sub
Private Sub
TextBox1_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
End Class
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Public Class Form5
Dim PANJANG As Integer
Dim LEBAR As Integer
Dim TINGGI As Integer
Dim VOLUME As Integer
Dim LUAS_PERMUKAAN As
Integer
(Dim
itu berarti menyatakandan integer itu berarti bilangan bulat)
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
Dim P = TextBox1.Text
Dim L = TextBox2.Text
Dim T = TextBox3.Text
TextBox4.Text = P * L * T
TextBox5.Text = ((2 * (P * L)) + (2 * (P * T)) + (2 * (L * T)))
(RUMUS
MENGHITUUNG VOLUME DAN LUAS PERMUKAAN)
Dim gambar As Graphics = Panel1.CreateGraphics
Dim Pensil As Pen
Pensil = New Pen(Drawing.Color.DarkRed, 2)
Dim x1 As New Integer
Dim x2 As New Integer
Dim y1 As New Integer
Dim y2 As New Integer
Dim width As New Integer
Dim height As New Integer
Dim Rect As New Rectangle
Dim lebar As New Integer
width =
Val(TextBox1.Text) * 37.795276 / 10
height =
Val(TextBox3.Text) * 37.795276 / 10
lebar =
Val(TextBox2.Text) * 37.795276 / 10
Rect.Width
= Val(TextBox1.Text) * 37.795276 / 10
Rect.Height
= Val(TextBox3.Text) * 37.795276 / 10
Rect.X = 10
Rect.Y =
(10 + lebar / 2)
gambar.DrawRectangle(Pensil, Rect)
Rect.X =
(10 + lebar / 2)
Rect.Y = 10
gambar.DrawRectangle(Pensil, Rect)
x1 = 10
y1 = (10 +
lebar / 2)
x2 = (10 +
lebar / 2)
y2 = 10
gambar.DrawLine(Pensil, x1, y1, x2, y2)
y1 = y1 +
height
y2 = y2 +
height
gambar.DrawLine(Pensil, x1, y1, x2, y2)
x1 = x1 +
width
x2 = x2 +
width
gambar.DrawLine(Pensil, x1, y1, x2, y2)
y1 = y1 -
height
y2 = y2 -
height
gambar.DrawLine(Pensil, x1, y1, x2, y2)
(menjalankan perintah untuk menghitung volume ,luas
permukaan dan menggambar balok sesuai yang diinginkan)
If TextBox1.Text > 95 And
TextBox2.Text > 70 And TextBox3.Text > 30
Then
MsgBox("terlalu besar")
Return
End If
(MEMBERI
PERINGATAN UNTUK KITA)
End Sub
Private Sub
Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
BackColor =
Color.Aqua
End Sub
(MEMBERI WARNA
BACKGROUND)
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 = ""
TextBox5.Text = ""
PANEL1.REFRESH()
End Sub
(MERESET
DATA-DATA)
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Form1.Show()
Me.Hide()
End Sub
(FORM1 SHOW SEDANGKAN FORM INI SENDIRI SEMBUNYI)
Private Sub
TextBox1_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Private Sub
TextBox2_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
Private Sub
TextBox3_keypress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
Dim masukan As Boolean = Char.IsDigit(e.KeyChar)
If Not masukan Then e.Handled = True
End Sub
(untuk
mengatur supaya textbox dapat diisi hanya dengan angka)
End Class
TUTORIAL
PROGRAM 2D DAN 3D
KOMPONEN TOOLBOX:
KOMPONEN
|
PROPERTIES
|
KETERANGAN
|
FORM1
|
NAME
TEXT
|
FORM1
APLIKASI
BANGUN
|
LABEL1
|
NAME
TEXT
|
LABEL1
APLIKASI
BANGUN 2D DAN 3D
|
LABEL2
|
NAME
TEXT
|
LABEL2
2D
|
LABEL3
|
NAME
TEXT
|
LABEL3
3D
|
LABEL4
|
NAME
TEXT
|
LABEL4
INFO
: SATUAN (MM)
|
RADIOBUTTON1
|
NAME
TEXT
|
RADIOBUTTON1
PERSEGI
|
RADIOBUTTON2
|
NAME
TEXT
|
RADIOBUTTON2
PERSEGI
PANJANG
|
RADIOBUTTON3
|
NAME
TEXT
|
RADIOBUTTON3
KUBUS
|
RADIOBUTTON4
|
NAME
TEXT
|
RADIOBUTTON4
BALOK
|
BUTTON1
|
NAME
TEXT
|
BUTTON1
OKE
|
BUTTON2
|
NAME
TEXT
|
BUTTON2
EXIT
|
KOMPONEN TOOLBOX
KOMPONEN
|
PROPERTIES
|
KETERANGAN
|
FORM2
|
NAME
TEXT
|
FORM2
PERSEGI
|
LABEL1
|
NAME
TEXT
|
LABEL1
SISI
|
LABEL2
|
NAME
TEXT
|
LABEL2
LUAS
|
LABEL3
|
NAME
TEXT
|
LABEL3
KELILING
|
LABEL
4
|
NAME
TEXT
|
LABEL4
NB
: BATAS MAKSIMAL 100
|
TEXTBOX1
|
NAME
TEXT
|
TEXTBOX1
|
TEXTBOX2
|
NAME
TEXT
|
TEXTBOX2
|
TEXTBOX3
|
NAME
TEXT
|
TEXTBOX3
|
BUTTON1
|
NAME
TEXT
|
BUTTON1
JADI
|
BUTTON2
|
NAME
TEXT
|
BUTTON2
CLEAR
|
BUTTON3
|
NAME
TEXT
|
BUTTON3
BACK
|
PANEL1
|
NAME
TEXT
|
PANEL1
|
KOMPONEN TOOLBOX:
KOMPONEN
|
PROPERTIES
|
KETERANGAN
|
FORM3
|
NAME
TEXT
|
FORM3
PERSEGI
PANJANG
|
LABEL1
|
NAME
TEXT
|
LABEL1
PANJANG
|
LABEL2
|
NAME
TEXT
|
LABEL2
LEBAR
|
LABEL3
|
NAME
TEXT
|
LABEL3
LUAS
|
LABEL4
|
NAME
TEXT
|
LABEL4
KELILING
|
LABEL5
|
NAME
TEXT
|
LABEL5
NB
: PANJANG MAKSIMAL 500 DAN LEBAR 190
|
TEXTBOX1
|
NAME
TEXT
|
TEXTBOX1
|
TEXTBOX2
|
NAME
TEXT
|
TEXTBOX2
|
TEXTBOX3
|
NAME
TEXT
|
TEXTBOX3
|
TEXTBOX4
|
NAME
TEXT
|
TEXTBOX4
|
BUTTON1
|
NAME
TEXT
|
BUTTON1
JADI
|
BUTTON2
|
NAME
TEXT
|
BUTTON2
CLEAR
|
BUTTON3
|
NAME
TEXT
|
BUTTON3
BACK
|
PANEL1
|
NAME
TEXT
|
PANEL1
|
KOMPONEN TOOLBOX:
KOMPONEN
|
PROPERTIES
|
KETERANGAN
|
FORM4
|
NAME
TEXT
|
FORM4
KUBUS
|
LABEL1
|
NAME
TEXT
|
LABEL1
SISI
|
LABEL2
|
NAME
TEXT
|
LABEL2
VOLUME
|
LABEL3
|
NAME
TEXT
|
LABEL3
LUAS
PERMUKAAN
|
LABEL4
|
NAME
TEXT
|
LABEL4
NB
: SISI MAKSIMAL 200
|
TEXTBOX1
|
NAME
TEXT
|
TEXTBOX1
|
TEXTBOX2
|
NAME
TEXT
|
TEXTBOX2
|
TEXTBOX3
|
NAME
TEXT
|
TEXTBOX3
|
BUTTON1
|
NAME
TEXT
|
BUTTON1
JADI
|
BUTTON2
|
NAME
TEXT
|
BUTTON2
CLEAR
|
BUTTON3
|
NAME
TEXT
|
BUTTON3
BACK
|
PANEL1
|
NAME
TEXT
|
PANEL1
|
KOMPONEN TOOLBOX:
KOMPONEN
|
PROPERTIES
|
KETERANGAN
|
FORM5
|
NAME
TEXT
|
FORM5
BALOK
|
LABEL1
|
NAME
TEXT
|
LABEL1
PANJANG
|
LABEL2
|
NAME
TEXT
|
LABEL2
LEBAR
|
LABEL3
|
NAME
TEXT
|
LABEL3
TINGGI
|
LABEL4
|
NAME
TEXT
|
LABEL4
VOLUME
|
LABEL5
|
NAME
TEXT
|
LABEL5
LUAS
PERMUKAAN
|
LABEL6
|
NAME
TEXT
|
LABEL6
NB
: MAKSIMAL PANJANG 95 LEBAR 70 TINGGI 30
|
TEXTBOX1
|
NAME
TEXT
|
TEXTBOX1
|
TEXTBOX2
|
NAME
TEXT
|
TEXTBOX2
|
TEXTBOX3
|
NAME
TEXT
|
TEXTBOX3
|
TEXTBOX4
|
NAME
TEXT
|
TEXTBOX4
|
TEXTBOX5
|
NAME
TEXT
|
TEXTBOX5
|
BUTTON1
|
NAME
TEXT
|
BUTTON1
JADI
|
BUTTON2
|
NAME
TEXT
|
BUTTON2
CLEAR
|
BUTTON3
|
NAME
TEXT
|
BUTTON3
BACK
|
PANEL1
|
NAME
TEXT
|
PANEL1
|
Tidak ada komentar:
Posting Komentar