Sunday, April 12, 2015

Menggunakan CheckBox dan OptionBox di VB

yap kali ini agan azure akan memperkenalkan / lebih tepatnya menunjukan Sebuah program VB yang menggunakan perpaduan  antara checkBox & OPtion BOx mungkin pada aplikasi saya ini saya sedikit mengulas tentang checkbox dan optionbox bahwa di dalam option box anda tidak bisa memilih program lebih dari 1 karna , option hanya di tunjukan untuk 1 pilihan bukan lebih sedangkan checkbox anda bisa memilih semuanya tak'akan dibatasi munkin cukup sekian penjelasanya dan coba perhatikan gambar berikut :

Berikut ini Script / Code dalam program berikut :
Private Sub Command2_Click()
Text17 = 0

If Check1.Value = 1 Then
Text17 = "9000000" * Val(Text1)
End If

If Check2.Value = 1 Then
Text17 = Val(Text17) + "5500000" * Val(Text2)
End If

If Check3.Value = 1 Then
Text17 = Val(Text17) + "8150000" * Val(Text3)
End If

If Check4.Value = 1 Then
Text17 = Val(Text17) + "14600000" * Val(Text4)
End If

If Check5.Value = 1 Then
Text17 = Val(Text17) + "7920000" * Val(Text5)
End If

If Check6.Value = 1 Then
Text17 = Val(Text17) + "7919000" * Val(Text6)
End If

If Check7.Value = 1 Then
Text17 = Val(Text17) + "8415000" * Val(Text7)
End If

If Check8.Value = 1 Then
Text17 = Val(Text17) + "15869000" * Val(Text8)
End If

If Check9.Value = 1 Then
Text17 = Val(Text17) + "7100000" * Val(Text9)
End If

If Check10.Value = 1 Then
Text17 = Val(Text17) + " 7100000" * Val(Text10)
End If

If Check11.Value = 1 Then
Text17 = Val(Text17) + "6800000" * Val(Text11)
End If

If Check12.Value = 1 Then
Text17 = Val(Text17) + "6000000" * Val(Text12)
End If

If Check13.Value = 1 Then
Text17 = Val(Text17) + "280000" * Val(Text13)
End If

If Check14.Value = 1 Then
Text17 = Val(Text17) + "240000" * Val(Text14)
End If

If Check15.Value = 1 Then
Text17 = Val(Text17) + "100000" * Val(Text15)
End If

If Check16.Value = 1 Then
Text17 = Val(Text17) + "50000" * Val(Text16)
End If

If Text17 > 5000000 Then
Text18 = "Tas Leptop"
ElseIf Text17 = 0 Then
Text18 = ""
Else
Text18 = "stiker"
End If

End Sub

Private Sub Command3_Click()
If MsgBox("Anda yakin akan keluar?", vbQuestion + vbYesNo, "Konfirmasi") = vbYes Then
        End
    End If
End Sub


Private Sub Form_Load()

End Sub

Private Sub Option1_Click()

If Option1.Value = True Then
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False

Check1.Visible = True
Check2.Visible = True
Check3.Visible = True
Check4.Visible = True
Check5.Visible = False
Check6.Visible = False
Check7.Visible = False
Check8.Visible = False
Check9.Visible = False
Check10.Visible = False
Check11.Visible = False
Check12.Visible = False
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Check9.Value = False
Check10.Value = False
Check11.Value = False
Check12.Value = False

Check9.Visible = True
Check10.Visible = True
Check11.Visible = True
Check12.Visible = True
Check1.Visible = False
Check2.Visible = False
Check3.Visible = False
Check4.Visible = False
Check5.Visible = False
Check6.Visible = False
Check7.Visible = False
Check8.Visible = False
End If
End Sub

Private Sub Option3_Click()
If Option3.Value = True Then
Check5.Value = False
Check6.Value = False
Check7.Value = False
Check8.Value = False

Check5.Visible = True
Check6.Visible = True
Check7.Visible = True
Check8.Visible = True
Check1.Visible = False
Check2.Visible = False
Check3.Visible = False
Check4.Visible = False
Check9.Visible = False
Check10.Visible = False
Check11.Visible = False
Check12.Visible = False
End If
End Sub

dan berikut Programnya yang bisa anda download :


Sekian dan terima kasih semoga bermanfaat

Berkomentarlah dengan baik dan sopan yang sesuai dengan topik artikel di atas dan jangan lupa centang Notify Me jika menginginkan balasan dari admin. Terima Kasih :)