Select a default value to display in Vb.NET Combobox (DataBound)


I have a combo-box in my form Form2 which is populate using databinding (code below). Form2 is activate from Form1.  Form1 has a id called CountryID which is passed to Form2 when Loaded.

I want to display the the Country in the combobox whose id values ,matches CountryID value  of Form1.  How would I do it?


I have following countries.

America  with ID 1
Canada with ID  2
England with ID 3
China with ID 4

Now if ID 3 is passed to the Form2 I want England to be displayed in the ComboBox.

Thanks in advance
Me.MyBindingSource.DataSource = CountryArray
    Me.cbCountryType.DataSource = MyBindingSource
    Me.cbCountryType.DisplayMember = "Country_Name"
    Me.cbCountryType.ValueMember = "CountryID"

Open in new window

Who is Participating?
bchoorConnect With a Mentor Commented:
Me.cbCountryType.SelectedValue = 3
Me.cbCountryType.SelectedValue = intValuePassed
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.