1. Pertama Buka aplikasi VISUAL BASIC 2008, lalu setelah program terbuka, klik FILE > New Project, maka akan muncul windows pop-up, lalu pilih “Windows Form Application”. Jika sudah di pilih isikan Nama dan Tempat Penyimpan project yang nanti akan di buat pada Name dan Location jika sudah klik Ok
Beberapa komponen toolbox dibutuhkan antara lain:
- 1 label
Text : ENTER THE NUMBER OF METERS
- 1 Textbox
Name : txtMeters
- 3 Buah button
Button1
Text : CONVERT TO INCHIES
Name : btnConvertToInchies
Button2
Text : CONVERT TO FEET
Name : btnConvertToFeet
Button3
Text : CONVERT TO YARD
Name : btnConvertToYard
3. Klik 2x pada button “CONVERT TO INCHES”, dan ketik script dibawah ini
Private Sub btnConvertToInchies_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToInchies.Click
Dim dblMeters As Double
Dim dblInches As Double
Try
dblMeters = CDbl(txtMeters.Text)
dblInches = MetersToInches(dblMeters)
MessageBox.Show(dblMeters.ToString() & " Meters equals " & dblInches.ToString() & " Inches")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
End Sub
4. Klik 2x pada button “CONVERT TO FEET”, dan ketik script dibawah ini
Private Sub btnConvertToFeet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToFeet.Click
Dim dblMeters As Double
Dim dblFeet As Double
Try
dblMeters = CDbl(txtMeters.Text)
dblFeet = MetersToFeet(dblMeters)
MessageBox.Show(dblMeters.ToString() & " Meters equals " & dblFeet.ToString() & " Feet")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
End Sub
5. Klik 2x pada button “CONVERT TO YARD”, dan ketik script dibawah ini
Private Sub btnConvertToYard_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToYard.Click
Dim dblMeters As Double
Dim dblYard As Double
Try
dblMeters = CDbl(txtMeters.Text)
dblYard = MetersToYard(dblMeters)
MessageBox.Show(dblMeters.ToString() & " Meters equals " & dblYard.ToString() & " Yard")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
End Sub
6. Tambahkan form2(diberi nama INCHES), dan desain dengan perintah dibawah ini
- 1 label
Text : ENTER THE NUMBER OF INCHES
- 1 Textbox
Name : txtInches
- 3 Buah button
Button1
Text : CONVERT TO MILI METER
Name : btnConvertToMM
Button2
Text : CONVERT TO CENTI METER
Name : btnConvertToCM
Button3
Text : CONVERT TO METER
Name : btnConvertToM
7. Klik 2x pada button “CONVERT TO MILI METER”, dan ketik script dibawah ini
Private Sub btnConvertToMM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToMM.Click
Dim dblInches As Double
Dim dblMiliMeters As Double
Try
dblInches = CDbl(txtInches.Text)
dblMiliMeters = InchesToMili(dblInches)
MessageBox.Show(dblInches.ToString() & " Inches equals " & dblMiliMeters.ToString() & " MiliMeters")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
8. Klik 2x pada button “CONVERT TO CENTI METER”, dan ketik script dibawah ini
Private Sub btnConvertToCM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToCM.Click
Dim dblInches As Double
Dim dblCentiMeters As Double
Try
dblInches = CDbl(txtInches.Text)
dblCentiMeters = InchesToCenti(dblInches)
MessageBox.Show(dblInches.ToString() & " Inches equals " & dblCentiMeters.ToString() & " CentiMeters")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
9. Klik 2x pada button “CONVERT TO CENTI METER”, dan ketik script dibawah ini
Private Sub btnConvertToM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvertToM.Click
Dim dblInches As Double
Dim dblMeters As Double
Try
dblInches = CDbl(txtInches.Text)
dblMeters = InchesToMeters(dblInches)
MessageBox.Show(dblInches.ToString() & " Inches equals " & dblMeters.ToString() & " Meters")
Catch
MessageBox.Show("Error: Enter a number value")
End Try
End Sub
10. Tambahkan MDI Form dan desain seperti dibawah ini
11. Kemudian copy script di bawah ini :
Private Sub PrintSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintSetupToolStripMenuItem.Click
METERS.Show()
End Sub
Private Sub INCHESTOMETERSToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INCHESTOMETERSToolStripMenuItem.Click
INCHES.Show()
End Sub
Private Sub EXITToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EXITToolStripMenuItem.Click
Me.Close()
End Sub
12. Run programnya dan isi angka untuk di convert
13. Pada Sub menu pilih ukuran mana yang akan di convert
14. Jika Meters to english, contohnya :
15. jika Inches To Meters, Contohnya:
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Selamat Mencoba dan Sukses yahhhh ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
J J J J J J J J J J
J J J J J
J J J J J
Tidak ada komentar:
Posting Komentar