program VB HURUF timbul,,maksudnya ketika mengetikkan huruf maka akan muncul huruf yang kita ketiikan seperti gambar dibawah ini

4

Untuk membuat program seperti diatas  mosukan kode listing dibawah ini…

Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub

Private Sub Text1_Change()

End Sub

Advertisements

Susulan Lagi

Private Sub Cbonpm_Click()

Dim nama, jurusan, HM As String

Select Case Cbonpm.Text

Case “12100502”

nama = “F. FERDY SETIAWAN”

jurusan = “Sistem Informasi”

Case “09200048”

nama = “RULY”

jurusan = “Manajemen Informatika”

Case “09300024”

nama = “SASKIA MECHA”

jurusan = “Tehnik Informatika”

End Select

txtnama.Text = nama

txtjurusan.Text = jurusan

txtquis.SetFocus

End Sub

Private Sub Cmdbatal_Click()

Cbonpm.SetFocus

Cbonpm.Text = “”

txtnama.Text = “”

txtjurusan.Text = “”

txtquis.Text = “”

txttugas.Text = “”

txtuts.Text = “”

txtuas.Text = “”

txtna.Text = “”

txthm.Text = “”

End Sub

Private Sub Cmdkeluar_Click()

Unload Me

End Sub

Private Sub Cmdproses_Click()

Dim NA As Integer

Dim HM As String

QUIS = Val(txtquis.Text)

TUGAS = Val(txttugas.Text)

UTS = Val(txtuts.Text)

UAS = Val(txtuas.Text)

NA = (QUIS + TUGAS + UTS + UAS) / 4

txtna.Text = NA

Select Case txtna.Text

Case Is > 80

HM = “A”

Case Is > 70

HM = “B”

Case Is > 60

HM = “C”

Case Is > 50

HM = “D”

Case Is < 50

HM = “E”

End Select

txthm.Text = HM

End Sub

Private Sub Form_Load()

Cbonpm.AddItem “09100027”

Cbonpm.AddItem “09200048”

Cbonpm.AddItem “09300024”

End Sub

Private Sub txtquis_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txttugas.SetFocus

End If

End Sub

Private Sub txttugas_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtuts.SetFocus

End If

End Sub

Private Sub txtuts_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtuas.SetFocus

End If

End Sub

HASILNYA

3

 

 

 

Susulan Tugas

Private Sub Cmdinput_Click()
Dim S As String
Txtth.Text = “20″ & Left(Txtnpm.Text, 2)
S = Mid(Txtnpm.Text, 3, 1)
If S = “1″ Then
Txtjur.Text = “Sistem Informasi”
ElseIf S = “2″ Then
Txtjur.Text = “Manajemen Informatika”
ElseIf S = “3″ Then
Txtjur.Text = “Tehnik Informatika”
ElseIf S = “4″ Then
Txtjur.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(Txtnpm.Text, 4, 2)
If S = “00″ Then
Txtprog.Text = “Strata Satu”
ElseIf S = “02″ Then
Txtprog.Text = “Diploma Tiga”
ElseIf S = “03″ Then
Txtprog.Text = “Diploma Empat”
ElseIf S = “04″ Then
Txtprog.Text = “Diploma Dua”
End If
Txtnor.Text = Right(Txtnpm.Text, 3)
End Sub

Private Sub Cmdout_Click()
Unload Me
End Sub

Private Sub Cmdreset_Click()
Txtnm.SetFocus
Txtnm.Text = “”
Txtnpm.Text = “”
Txtjur.Text = “”
Txtprog.Text = “”
Txtth.Text = “”
Txtnor.Text = “”
End Sub

Private Sub Txtnm_Keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
Txtnpm.SetFocus
End If
End Sub

Private Sub Txtnpm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Cmdinput.SetFocus
End If
End Sub

HASILNYA

2

1

Private Sub Cmdcan_Click()
txtnm.SetFocus
txtnm.Text = “”
txtnik.Text = “”
End Sub

Private Sub Cmdpro_Click()
Dim jbt, bg As String
Dim gp, tj, tg As Currency
txttahun.Text = Left(txtnik.Text, 4)
G = Mid(txtnik.Text, 5, 1)
If G = “A” Then
G = “A”
jbt = ” MANAGER”
gp = “1000000”
tj = “200000”
ElseIf G = “B” Then
G = “B”
jbt = ” Seksi Banget”
gp = “400000”
tj = “200000”
ElseIf G = “C” Then
G = “C”
jbt = ” setaf”
gp = “300000”
tj = “1000”
ElseIf G = “D” Then
G = “D”
jbt = ” Juru Parkir”
gp = “200000”
tj = “100000”
ElseIf G = “E” Then
G = “E”
jbt = ” Juru Kunci”
gp = “1000”
tj = “1000”
End If
txtgol.Text = G
txtjbt.Text = jbt
txtgp.Text = gp
txttj.Text = tj
KS = Mid(txtnik.Text, 7, 1)
If KS = “S” Then
KS = “S”
ksta = ” SINGGLE”
ElseIf KS = “B” Then
KS = “B”
ksta = “BERDUA”
ElseIf KS = “D” Then
KS = “D”
ksta = “DUDA”
ElseIf KS = “J” Then
KS = “J”
ksta = “JANDA”
ElseIf KS = “BA” Then
KS = “BA”
ksta = “BANYAK ANAK”
End If
txtks.Text = KS
txtksta.Text = ksta
tg = Val(txtgp.Text) + Val(txttj.Text)
txttg.Text = tg
B = Right(txtnik.Text, 3)
If B = “KEU” Then
txtbg.Text = “AKUNTING”
ElseIf B = “ADM” Then
txtbg.Text = “ADMINISTRASI”
ElseIf B = “SDM” Then
txtbg.Text = “SUMBER DAYA MANUSIA”
ElseIf B = “EDP” Then
txtbg.Text = “IT UNIT”
ElseIf B = “SPM” Then
txtbg.Text = “KEAMANAN”
End If
End Sub
Private Sub Cmdquit_Click()
Unload Me
End Sub

Private Sub Cmdrep_Click()
txtnm.SetFocus
txtnm.Text = “”
txtnikText = “”
txtgol.Text = “”
txtjbt.Text = “”
txtgp.Text = “”
txttj.Text = “”
txtks.Text = “”
txtksta.Text = “”
txttg.Text = “”
txtbg.Text = “”
txttahun.Text = “”
End Sub

Private Sub txtnm_keypre()

End Sub

Private Sub txtnm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnik.SetFocus
End If
End Sub

Private Sub txtnik_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Cmdpro.SetFocus
End If
End Sub

 

 

Susulan Tugas VB

TUGAS VISUAL BASIC 1: MEMBUAT PROGRAM 2 BILANGAN
Sekarang ane mau posting tentang bagaimana caranya membuat program perkalian 2 bilangan menggunakan visual basic, seperti gambar berikut, yuk ikutin caranya.

Buka aplikasi viisual basic 6.0
Kemudian pilih Standard EXE klik open sampe muncul tampilan sbb.

3. Kemudian pada Form1, kita tambahkan label, text dan command sesuai dengan soal yang kita garap tadi

4. Lalu kita dobel klik pada text1 dan masukkan rumus berikut:

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

5. Lalu kita dobel klik pada Command1 dan masukkan rumus berikut:

Private Sub Command1_Click()

Text3.Text = Val(Text1.Text) * Val(Text2.Text)

End Sub

6. Lalu kita dobel klik pada Command2 dan masukkan rumus berikut:

Private Sub Command2_Click()

Text1.SetFocus

Text1 = ” “

Text2 = ” “

Text3 = ” “

End Sub

7. Lalu kita dobel klik pada Command3 dan masukkan rumus berikut:

Private Sub Command3_Click()

End

End Sub

8. Selesai, mudah bukan….

Tampilan rumus nya seperti ini:

Maka apabila program dijalankan, hasilnya seperti ini:

 

 

 

 

 

 

TUGAS VISUAL BASIC 5 : MEMBUAT PROGRAM PERHITUNGAN GAJI

Pastinya buka aplikasi visual basic dulu dong
Buat form seperti berikut ini

3. Kode untuk text1 sampai text 3

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text3.SetFocus

End If

End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)

Text5.Text = Val(Text4.Text) * 0.1

Text6.Text = Val(Text4.Text) – Val(Text5.Text)

End If

End Sub

4. Kode untuk command 1 dan 2

Private Sub Command1_Click()

Text1.SetFocus

Text1 = ” “

Text2 = ” “

Text3 = ” “

Text4 = ” “

Text5 = ” “

Text6 = ” “

End Sub

Private Sub Command2_Click()

End

End Sub

5. Selesaiiiii

Berikut hasilnnya:

 

MEMBUAT PROGRAM PERHITUNGAN DISKON

Buka visual basic
Buat form seperti berikut ini

3. Klik 2 kali pada text1, dan masukkan kode berikut:

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.Text = Val(Text1.Text) * 0.2

Text3.Text = Val(Text1.Text) – Val(Text2.Text)

End If

End Sub

4. Klik 2 kali pada command1, dan masukkan kode berikut:

Private Sub Command1_Click()

Text1.SetFocus

Text1 = ” “

Text2 = ” “

Text3 = ” “

End Sub

5. Klik 2 kali pada command2, dan masukkan kode berikut:

Private Sub Command2_Click()

End

End Sub

6. Selesai,, mudah kan,, makanya jangan kapok belajar visual basic

 

 FONT STYLE DAN FONT COLOR

Seperti biasa buka dulu aplikasi visual basic nya
Buat form seperti gambar berikut

3. Berikut adalah rumus option1 sampai option6 (red-black):

Private Sub Option1_Click()

lbljudul.ForeColor = vbRed

End Sub

Private Sub Option2_Click()

lbljudul.ForeColor = vbBlue

End Sub

Private Sub Option3_Click()

lbljudul.ForeColor = vbGreen

End Sub

Private Sub Option4_Click()

lbljudul.ForeColor = vbYellow

End Sub

Private Sub Option5_Click()

lbljudul.ForeColor = vbWhite

End Sub

Private Sub Option6_Click()

lbljudul.ForeColor = vbBlack

End Sub

4. Dan berikut adalah rumus check1 sampai check3 (bold, italic, underlined)

Private Sub Check1_Click()

If Check1.Value = 1 Then

lbljudul.FontBold = True

Else

lbljudul.FontBold = False

End If

End Sub

Private Sub Check2_Click()

If Check2.Value = 1 Then

lbljudul.FontItalic = True

Else

lbljudul.FontItalic = False

End If

End Sub

Private Sub Check3_Click()

If Check3.Value = 1 Then

lbljudul.FontUnderline = True

Else

lbljudul.FontUnderline = False

End If

End Sub

5. Selesai,,, gampang bukan…

 

 MEMBUAT PROGRAM 2 BILANGAN Part 2

Seperti biasa buka dulu program visual basic nya
Buat lah form seperti berikut (sobat semua pasti dh tau caranya buatnya)….

3. Dobel klik pada text1, lalu masukkan Rumus berikut:

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

4. Dobel klik pada command1, lalu masukkan rumus berikut:

Private Sub Command1_Click()

Text3.Text = Val(Text1.Text) + Val(Text2.Text)

End Sub

5. Dobel klik pada command2, lalu masukkan rumus berikut:

Private Sub Command2_Click()

Text3.Text = Val(Text1.Text) – Val(Text2.Text)

End Sub

6. Dobel klik pada command3, lalu masukkan rumus berikut:

Private Sub Command3_Click()

Text3.Text = Val(Text1.Text) * Val(Text2.Text)

End Sub

7. Dobel klik pada command4, lalu masukkan rumus berikut:

Private Sub Command4_Click()

Text3.Text = Val(Text1.Text) / Val(Text2.Text)

End Sub

8. Dobel klik pada command5, lalu masukkan rumus berikut:

Private Sub Command5_Click()

Text1.SetFocus

Text1 = ” “

Text2 = ” “

Text3 = ” “

End Sub

9. Dobel klik pada command6, lalu masukkan rumus berikut:

Private Sub Command6_Click()

End

End Sub

Tugas Visual Basic 5

vb

Private Sub CmdBaru_Click()
Data1.Recordset.AddNew
TxtNama.SetFocus
End Sub
Private Sub CmdHapus_Click()
Data1.Recordset.Delete
End Sub

Private Sub CmdKeluar_Click()
Unload Me
End Sub

Private Sub CmdProses_Click()
Dim S As String
TxtTm.Text = “20” & Left(TxtNpm.Text, 2)
S = Mid(TxtNpm.Text, 3, 1)
If S = “1” Then
JUR = “Tehnik Komputer”
ElseIf S = “2” Then
JUR = “Manajemen Informatika”
ElseIf S = “3” Then
JUR = “Tehnik Informatika”
ElseIf S = “4” Then
JUR = “Manajemen & Komp. Akuntansi”
End If
TxtJur.Text = JUR
S = Mid(TxtNpm.Text, 4, 2)
If S = “00” Then
PS = “Strata Satu”
ElseIf S = “01” Then
PS = “Diploma Tiga”
ElseIf S = “02” Then
PS = “Diploma Empat”
ElseIf S = “03” Then
PS = “Diploma Dua”
End If
TxtPs.Text = PS
TxtNu.Text = Right(TxtNpm.Text, 3)
End Sub

Private Sub CmdSimpan_Click()
Data1.Recordset.Update
End Sub

tugas visual basic

lebih baik terlambat dari pada tidak sama sekali,,
ini lah yang saya alami,,akhirnya bisa juga posting tugas visual basic,,ini semua berkat bantuan rekan-rekan twiter tiga,,trima ksih untuk kalian semua,,saya bisa juga buat program
ini program nik dan nama karyawan, serta jabatan gaji tunjangan dll, seperti contoh dibawah ini

FERDI

ini kodenya
Private Sub Cmdlagi_Click()
txtnm.SetFocus
txtnm.Text = “”
txtnikText = “”
txtgol.Text = “”
txtjbt.Text = “”
txtgp.Text = “”
txttj.Text = “”
txtks.Text = “”
txtksta.Text = “”
txttg.Text = “”
txtbg.Text = “”
txttahun.Text = “”
End Sub

Private Sub Cmdpro_Click()
Dim jbt, bg As String
Dim gp, tj, tg As Currency
txttahun.Text = Left(txtnik.Text, 4)
G = Mid(txtnik.Text, 5, 1)
If G = “A” Then
G = “A”
jbt = ” KOMANDAN”
gp = “1000000000”
tj = “1000000”
ElseIf G = “B” Then
G = “B”
jbt = ” Seksi KEUANGAN”
gp = “40000000”
tj = “500000”
ElseIf G = “C” Then
G = “C”
jbt = “CREW”
gp = “30000000”
tj = “500000”
ElseIf G = “D” Then
G = “D”
jbt = ” Juru Parkir”
gp = “200000”
tj = “100000”
ElseIf G = “E” Then
G = “E”
jbt = ” Juru Kunci”
gp = “1000”
tj = “1000”
End If
txtgol.Text = G
txtjbt.Text = jbt
txtgp.Text = gp
txttj.Text = tj
KS = Mid(txtnik.Text, 7, 1)
If KS = “S” Then
KS = “S”
ksta = ” SINGGLE”
ElseIf KS = “B” Then
KS = “B”
ksta = “BERDUA”
ElseIf KS = “D” Then
KS = “D”
ksta = “DUDA”
ElseIf KS = “J” Then
KS = “J”
ksta = “JANDA”
ElseIf KS = “BA” Then
KS = “BA”
ksta = “BANYAK ANAK”
End If
txtks.Text = KS
txtksta.Text = ksta
tg = Val(txtgp.Text) + Val(txttj.Text)
txttg.Text = tg
B = Right(txtnik.Text, 3)
If B = “BOS” Then
txtbg.Text = “BOS ok”
ElseIf B = “ADM” Then
txtbg.Text = “ADMINISTRASI”
ElseIf B = “SDM” Then
txtbg.Text = “SUMBER DAYA MANUSIA”
ElseIf B = “EDP” Then
txtbg.Text = “IT UNIT”
ElseIf B = “SPM” Then
txtbg.Text = “KEAMANAN”
End If
End Sub

Private Sub Cmdulang_Click()
txtnm.SetFocus
txtnm.Text = “”
txtnik.Text = “”
End Sub

Private Sub Command4_Click()
Unload Me
End Sub
Private Sub txtnm_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtnik.SetFocus
End If
End Sub