Refer this
C#
private void Form2_Load(object sender, EventArgs e)
{
PopulateCombobox();
}
private void PopulateCombobox()
{
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Country", typeof(string));
dt.Rows.Add(1, "USA");
dt.Rows.Add(2, "England");
dt.Rows.Add(3, "India");
this.cbNames.ValueMember = "Country";
this.cbNames.DisplayMember = "Id";
this.cbNames.DataSource = dt;
}
private void cbNames_SelectedIndexChanged(object sender, EventArgs e)
{
this.textBox1.Text = this.cbNames.SelectedValue.ToString();
}
VB
Private Sub Form2_Load(sender As Object, e As EventArgs)
PopulateCombobox()
End Sub
Private Sub PopulateCombobox()
Dim dt As New DataTable()
dt.Columns.Add("Id", GetType(Integer))
dt.Columns.Add("Country", GetType(String))
dt.Rows.Add(1, "USA")
dt.Rows.Add(2, "England")
dt.Rows.Add(3, "India")
Me.cbNames.ValueMember = "Country"
Me.cbNames.DisplayMember = "Id"
Me.cbNames.DataSource = dt
End Sub
Private Sub cbNames_SelectedIndexChanged(sender As Object, e As EventArgs)
Me.textBox1.Text = Me.cbNames.SelectedValue.ToString()
End Sub