Blogger Widgets hendra saputra: APLIKASI PENGULANGAN COMBOBOX & LISTBOX

hendra saputra

Read more: http://www.rayhanzhampiet.com/2012/01/cara-membuat-teks-pada-kursor.html#ixzz3HPNZVfzz

Selasa, 18 November 2014

APLIKASI PENGULANGAN COMBOBOX & LISTBOX

Private Sub CmbItem_Change()
 Lstsumber.AddItem CmbItem.Text
'cmbItem.RemoveItem cmbItem.ListIndex
End Sub

Private Sub CmdAdd_Click()
 If Txtjml.Text = "" Then
   MsgBox "Jumlah Item Harus di Isi", vbOKOnly + vbExclamation, "Peringatan"
   Txtjml.SetFocus
Else
For I = 1 To Txtjml.Text
  Number = InputBox("Masukan Nama Item ke -" & I & "", "Input data")
         If Number = "" Then
            Exit Sub
         End If
  CmbItem.AddItem Number
Next I
Txtjml.Text = Clear
End If
End Sub

Private Sub cmdAddKanan_Click()
If LstPilih.ListIndex < 0 Then
   MsgBox "Data Tidak diPilih/Kosong", vbOKOnly + vbInformation, "Validasi"
   Txtjml.SetFocus
Else
   Lstsumber.AddItem LstPilih.Text
   LstPilih.RemoveItem LstPilih.ListIndex
End If
End Sub

Private Sub cmdAddKiri_Click()
 If Lstsumber.ListIndex < 0 Then
   MsgBox "Data Tidak Dipilih/Kosong", vbOKOnly + vbInformation, "Validasi"
   Txtjml.SetFocus
Else
   LstPilih.AddItem Lstsumber.Text
   Lstsumber.RemoveItem Lstsumber.ListIndex
End If
End Sub

Private Sub cmdAllKanan_Click()
 If LstPilih.ListCount < 1 Then
   MsgBox "Data Pilihan Kosong", vbOKOnly + vbExclamation, "Validasi"
   Txtjml.SetFocus
Else
   For I = 0 To LstPilih.ListCount - 1
   Lstsumber.AddItem LstPilih.List(I)
   Next I
   LstPilih.Clear
End If
End Sub

Private Sub cmdAllKiri_Click()
 If Lstsumber.ListCount < 1 Then
   MsgBox "Data Sumber Kosong", vbOKOnly + vbExclamation, "Validasi"
   Txtjum.SetFocus
Else
   For I = 0 To Lstsumber.ListCount - 1
   LstPilih.AddItem Lstsumber.List(I)
   Next I
   Lstsumber.Clear
End If
End Sub

Private Sub Form_Load()
Lstsumber.AddItem "data satu"
Lstsumber.AddItem "data dua"
Lstsumber.AddItem "data tiga"
Lstsumber.AddItem "data empat"
Lstsumber.AddItem "data lima"
End Sub
Private Sub Txtjml_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
CmdAdd.SetFocus
End If
If Not (KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Or KeyAscii = vbKeyBack Or KeyAscii = vbKeyDelete Or KeyAscii = vbKeySpace Or KeyAscii = vbKeyReturn) Then
MsgBox "Maaf Hanya Boleh Diisi Angka Saja", vbInformation + vbOKOnly, "Perhatian"
KeyAscii = 0
End If
End Sub
Private Sub Form_activate()
Txtjml.SetFocus
End Sub

Private Sub CmdExit_Click()
Unload Me
End Sub


Tidak ada komentar:

Posting Komentar