Click here to Skip to main content
15,902,635 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to retrieve data in combobox from sql,
and after selecteditems of combobox fill many textBoxes
Posted
Updated 22-Jul-13 1:28am
v2
Comments
TrekkieTech 22-Jul-13 7:14am    
Can you clarify the question, maybe with an example or a more in-depth description of your problem please?
Thanks7872 22-Jul-13 7:21am    
SQL data,combobox and 'many textboxes' all are different things.What you want to do is not clear.
ridoy 22-Jul-13 7:45am    
not a question.

I am not sure, what exact output you want. but you can try these solutions:

C#
string Text = ComboBox1.Text;


Or you can use
C#
int Index = ComboBox1.SelectedIndex;

sttring text = ComboBox1.Items[Index].ToString;


OR

C#
DataRow selectedDataRow = ((DataRowView)comboBox1.SelectedItem).Row;
int Id = Convert.ToInt32(selectedDataRow["Id"]);
string Name = selectedDataRow["Name"].ToString();

int selectedValue = Convert.ToInt32(comboBox1.SelectedValue);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900