Code
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.Text = "DropDown"
RadioButton2.Text = "DropDownList"
RadioButton1.Select()
ComboBox1.Items.Add("English")
ComboBox1.Items.Add("Indonesian")
ComboBox1.SelectedIndex = 0
End Sub
Private Sub RadioButton1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles RadioButton1.Click
ComboBox1.DropDownStyle = ComboBoxStyle.DropDown
ComboBox2.DropDownStyle = ComboBoxStyle.DropDown
End Sub
Private Sub RadioButton2_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles RadioButton2.Click
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
ComboBox2.DropDownStyle = ComboBoxStyle.DropDownList
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender _
As System.Object, ByVal e As System.EventArgs) Handles _
ComboBox1.SelectedIndexChanged
ComboBox2.Items.Clear()
Select Case ComboBox1.SelectedIndex
Case 0
With ComboBox2.Items
.Add("Monday")
.Add("Tuesday")
.Add("Wednesday")
.Add("Thursday")
.Add("Friday")
.Add("Saturday")
.Add("Sunday")
End With
Case 1
With ComboBox2.Items
.Add("Senin")
.Add("Selasa")
.Add("Rabu")
.Add("Kamis")
.Add("Jumat")
.Add("Sabtu")
.Add("Minggu")
End With
End Select
ComboBox2.SelectedIndex = Now.DayOfWeek - 1
End Sub
End Class
Run Time
Click here if you like this article.
Artikel Terkait:
ComboBox Properties
ComboBox Event
ComboBox Control
Common Control Visual Basic.NET
Tutorial Visual Basic .NET
Contoh Project:
ComboBox Control Sample Project
5 Comments
di form load nya di buat juga mbak?
Private Sub cbo_departemen_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbo_departemen.SelectedValueChanged
cbo_section.Enabled = True
If Not IsNothing(cbo_departemen.SelectedValue) Then
Dim idevision As Integer = cbo_devision.SelectedValue
Dim iddepartment As Integer = cbo_departemen.SelectedValue
rs = cn.Execute("SELECT distinct [department_code], [department_description] FROM [AN_SUMATRA].[dbo].[TM_tb_subsection] WHERE [devision_code]='" & idevision & "' and [department_code]='" & iddepartment & "' ORDER BY [department_code] ASC")
End If
End Sub
tetapi gak nampil dia
database nya pake access, silahkan disesuaikan sama database yang Panji pakai