I have a combo box that I am populating as per the following code.
It is coming from a table that has 8 fields per record and in the combo box i am making the first field of the record appear in the Combo Box.
My question is as follows. If I have 50 records in the underlying table I want to be able to select any of the names in the first column of the table and get the contents of the other 7 fields in the row from the table and store them in global variables.
So if I have have selected Name 1 from the table which is showing in the combo box I would like to be able to assign the other 7 fields contents to constant variables to be used furhter in the program.
Here is the code I am using .......
this.cboCombo.Visible = true;
SqlConnection cs = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename='C:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\Names.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True");
// Create the data apadter
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Names ORDER by Full_Name", cs);
// Create the Data Table
DataTable dt = new DataTable();
// Fill Data Table with Records
// Loop around the table and populate the combo box with records....
for (int i = 0; i < dt.Rows.Count; i++)
So at this point i have got the Full Names from the Table Names and i have loaded them into the Combobox and when i click on the combo box i would like to retreive the contents of the other 7 fields in the underlying table and place them into variables.
Is this possible ???
regards in advance