Question : ComboBox - Retrieving information from an Access table in Visual Basic

I am using Visual Basic 2008 Express Edition and what I am trying to do is the following:

1. Populate a ComboBox with the entries of one of the fields in a Microsoft Access database.
2. When an item in the ComboBox selected during runtime, I want certain properties from that row to be loaded to certain strings.

I have tried working this out myself from the guidance on here but unfortunately it has not been specific to my own needs and therefore I have had trouble adapting it accordingly and got myself completely lost.

Here is some information I hope will be helpful

Name of ComboBox: MatchComboBox
Name of Database: Matchtype.mdb
Path of Database: C:\Users\Lee\Documents\Visual Studio 2008\Projects\_Wrestler\Lee - Fighter Game 1\ Matchtype.mdb
Name of Table: Matches

Name of database fields, with names of the intended strings in brackets:
ID (matchid)
Match Name (matchname)
Type (matchtype)
Tournament (tournament)
Participants (participants)


I want the Match Name field to be the one that populates MatchComboBox

Many thanks

Answer : ComboBox - Retrieving information from an Access table in Visual Basic

You do´nt show the code statement for exception.

  Are you cast  SelectedValue or SelectedIndex ?

You can use the event SelectedIndexChanged or SelectedValueChanged. This is´nt important.

  You can use   MyComboBox.Items(MyComboBox.SelectedIndex)
  or                   MyComboBox.SelectedValue

  The second option is the recomended.
Random Solutions  
 
programming4us programming4us