Ada Yang tahu Visual basic suatu software untuk menciptakan software lainya :D
disini kita akan mencoba membuat software Suhu Konverter ya sobat langsung saja di simak ...
Buka Visual Basic 6.0 :
1. Masukkan 5 buah Label
2. Masukkan 1 buah Frame
3. Masukkan 5 buah TextBox
4. Masukkan 4 buah OptionButton
5. Masukkan 3 buah CommandButton
Setelah itu pada bagian Properties ganti Caption :
1. Label1 ubah Menjadi “Masukkan Suhu yang Telah Diketahui dan Tekan Tombol Konversi” atau sesuka teman-teman.
2. Label2 Menjadi “Fahrenheit”
3. Label3 Menjadi “Celcius”
4. Label4 Menjadi “Rheamur”
5. Label5 Menjadi “Kelvin”
6. Frame1 Menjadi “Masukkan Pilihan Input”
7. OptionButton1 Menjadi “Fahrenheit”
8. OptionButton2 Menjadi “Celcius”
9. OptionButton3 Menjadi “Rheamur”
10. OptionButton4 Menjadi “Kelvin”
11. CommandButton1 Menjadi “&Konversi”
12. CommandButton2 Menjadi “&Again”
13. CommandButton3 Menjadi “&Exit”
Selanjutnya rapikan Label,Frame,TextBox,OptionButton, dan CommandButton menjadi seperti gambar dibawah ini.
Tampilan visual
Okey tampilan di samakan sama yang di atas ya sobat, sekarang kita akan belajar mengkoding tanpa coding ni software gak bisa apa-apa gan. langsung saja :D
Inilah Script programnya :
1. Pada Form Load
Private Sub Form_Load()
Option1 = True
End Sub
2. Pada Option1
Private Sub Option1_Click()
If Option1 = True Then
Option2 = False And Option13 = False And Option4 = False
End If
End Sub
3. Comand1
Private Sub Command1_Click()
Dim jwb As Integer
If Text1.Text = "" Then
jwb = MsgBox("Masukkan Nilai Suhu Yang Akan Dikonversi!!! ", _
vbInformation + vbYesNo, "WARNING")
If jwb = vbNo Then
Unload Me
ElseIf jwb = vbYes Then
FrmKonversiSuhu.Show
End If
ElseIf Option1 = True Then
Fahrenheit
ElseIf Option2 = True Then
Celcius
ElseIf Option3 = True Then
Rheamur
ElseIf Option4 = True Then
Kelvin
End If
End Sub
4. Pada Coman2
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text2.BackColor = "&H80000005"
Text3.BackColor = "&H80000005"
Text4.BackColor = "&H80000005"
Text5.BackColor = "&H80000005"
Text1.SetFocus
End Sub
5. pada command3
Private Sub Command3_Click()
Unload Me
End Sub
6. Tulislah script di bawah ini di program paling bawah program kakak.
Sub Celcius()
Dim bil1, fah, rhe, kel As Integer
bil1 = Text1
fah = Val((Text1.Text) * 9 / 5) + 32
Text2.Text = FormatNumber(fah, 2, vbFalse, vbFalse, vbFalse)
rhe = Val(Text1.Text) * 4 / 5
Text4.Text = FormatNumber(rhe, 2, vbFalse, vbFalse, vbFalse)
kel = Val(Text1.Text) + 273
Text5.Text = FormatNumber(kel, 2, vbFalse, vbFalse, vbFalse)
Text3.BackColor = black
End Sub
Sub Fahrenheit()
Dim bil1, cel, rhe, kel As Integer
bil1 = Text1
cel = Val((Text1.Text) - 32) * 5 / 9
Text3.Text = FormatNumber(cel, 2, vbFalse, vbFalse, vbFalse)
rhe = Val((Text1.Text) - 32) * 4 / 9
Text4.Text = FormatNumber(rhe, 2, vbFalse, vbFalse, vbFalse)
kel = Val(((Text1.Text) - 32) * 5 / 9) + 273
Text5.Text = FormatNumber(kel, 2, vbFalse, vbFalse, vbFalse)
Text2.BackColor = black
End Sub
Sub Rheamur()
Dim bil1, fah, cel, kel As Integer
bil1 = Text1
fah = Val((Text1.Text) * 9 / 4) + 32
Text2.Text = FormatNumber(fah, 2, vbFalse, vbFalse, vbFalse)
cel = Val(Text1.Text) * 5 / 4
Text3.Text = FormatNumber(cel, 2, vbFalse, vbFalse, vbFalse)
kel = Val((Text1.Text) * 5 / 4) + 273
Text5.Text = FormatNumber(kel, 2, vbFalse, vbFalse, vbFalse)
Text4.BackColor = black
End Sub
Sub Kelvin()
Dim bil1, fah, cel, rhe As Integer
bil1 = Text1
fah = Val((((Text1.Text) - 273) * 9 / 5)) + 32
Text2.Text = FormatNumber(fah, 2, vbFalse, vbFalse, vbFalse)
cel = Val(Text1.Text) - 273
Text3.Text = FormatNumber(cel, 2, vbFalse, vbFalse, vbFalse)
rhe = Val((Text1.Text) - 273) * 4 / 5
Text4.Text = FormatNumber(rhe, 2, vbFalse, vbFalse, vbFalse)
Text5.BackColor = black
End Sub
Gimana sudah bisa belum... Kalau ada pertanyaan silahkan lempar makanan adminya dulu ya. salam sejahtera
Title : Membuat Software Suhu Konversi
Description : Ada Yang tahu Visual basic suatu software untuk menciptakan software lainya :D disini kita akan mencoba membuat software Suhu Konverter ya ...