translate

ramp my enterprenuer inspiration

Rabu, 02 Desember 2009

pemprograman komputer (contoh VB)

 

contoh VB untuk input data pegawai:


Private Sub Cmbjabatan_Click()
  If Cmbjabatan.ListIndex = -1 Then
  gaji = 0
  tunjang = 0
  ttl = 0
  ElseIf Cmbjabatan.ListIndex = 0 Then
  gaji = 1500000
  tunjang = 0.1 * gaji
  ttl = gaji + tunjang
  ElseIf Cmbjabatan.ListIndex = 1 Then
  gaji = 1200000
  tunjang = 0.08 * gaji
  ttl = gaji + tunjang
  ElseIf Cmbjabatan.ListIndex = 2 Then
  gaji = 1000000
  tunjang = 0.05 * gaji
  ttl = gaji + tunjang
  Else
  gaji = 750000
  tunjang = 0.025 * gaji
  ttl = gaji + tunjang
  End If
  txtgapok.Text = Format(gaji, "###,###,###")
  txttunjang.Text = Format(tunjang, "###,###,###")
  txttotal.Text = Format(ttl, "###,###,###")
  End Sub

Private Sub Command1_Click()
  txtnip.Text = Clear
  txtnama.Text = Clear
  Cmbjabatan.Text = Clear
  txtgapok.Text = Clear
  txttunjang.Text = Clear
  txttotal.Text = Clear
  txtnip.SetFocus
   
End Sub

Private Sub Command2_Click()
  Unload Me
End Sub

Private Sub Form_Load()
  Cmbjabatan.AddItem "Direktur"
  Cmbjabatan.AddItem "Sekretaris"
  Cmbjabatan.AddItem "Bendahara"
  Cmbjabatan.AddItem "Staff"
End Sub




















 



Private Sub Cmbkode_Click()
If Cmbkode.Text = "A1" Then
  txtkamar.Text = "VIP ROOM"
  txtharga.Text = 250000
  ElseIf Cmbkode.Text = "A2" Then
  txtkamar.Text = "FLAMBOYAN"
  txtharga.Text = 200000
  ElseIf Cmbkode.Text = "A3" Then
  txtkamar.Text = "MELATI"
  txtharga.Text = 150000
  ElseIf Cmbkode.Text = "A4" Then
  txtkamar.Text = "PALEM"
  txtharga.Text = 100000
Else
  txtkamar.Text = "SLAH DATA"
  txtharga.Text = 0
End If
txtharga.Text = Format(txtharga.Text, "###,###,###,#0")
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
txtnama.Text = Clear
Cmbkode.Text = Clear
txtharga.Text = Clear
txtlama.Text = Clear
txttotal.Text = Clear
txtdiskon.Text = Clear
txtbayar.Text = Clear
txtkamar.Text = Clear

End Sub

Private Sub DS0_Click()
If DS0.Value Then
  txtdiskon.Text = 0 * txttotal.Text
  txtbayar.Text = txttotal.Text - txtdiskon.Text
Else
  DS0.Value = True
End If
  txtdiskon.Text = Format(txtdiskon.Text, "###,###,###,#0")
  txtbayar.Text = Format(txtbayar.Text, "###,###,###,#0")

End Sub

Private Sub DS10_Click()
If DS10.Value Then
  txtdiskon.Text = 0.3 * txttotal.Text
  txtbayar.Text = txttotal.Text - txtdiskon.Text
Else
  DS10.Value = True
End If
  txtdiskon.Text = Format(txtdiskon.Text, "###,###,###,#0")
  txtbayar.Text = Format(txtbayar.Text, "###,###,###,#0")

End Sub

Private Sub DS20_Click()
If DS20.Value Then
  txtdiskon.Text = 0.1 * txttotal.Text
  txtbayar.Text = txttotal.Text - txtdiskon.Text
Else
  DS20.Value = True
End If
  txtdiskon.Text = Format(txtdiskon.Text, "###,###,###,#0")
  txtbayar.Text = Format(txtbayar.Text, "###,###,###,#0")

End Sub

Private Sub DS30_Click()
If DS30.Value Then
  txtdiskon.Text = 0.3 * txttotal.Text
  txtbayar.Text = txttotal.Text - txtdiskon.Text
Else
  DS30.Value = True
End If
  txtdiskon.Text = Format(txtdiskon.Text, "###,###,###,#0")
  txtbayar.Text = Format(txtbayar.Text, "###,###,###,#0")
   
   
End Sub

Private Sub Form_Load()
Cmbkode.AddItem "A1"
Cmbkode.AddItem "A2"
Cmbkode.AddItem "A3"
Cmbkode.AddItem "A4"
DS30.Value = False
DS20.Value = False
DS10.Value = False
DS0.Value = False
End Sub

Private Sub txtlama_Validate(Cancel As Boolean)
txttotal.Text = txtharga.Text * Val(txtlama.Text)
txttotal.Text = Format(txttotal.Text, "###,###,###,#0")
End Sub
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 komentar: on "pemprograman komputer (contoh VB)"

Posting Komentar