Home > Net >  C # combobox how to display the data in the table rows of data?
C # combobox how to display the data in the table rows of data?

Time:04-30

 
Mycon. The Open ();
SqlDataAdapter sda=new SqlDataAdapter (" select * from ShenNai ", mycon);
The DataTable table=new DataTable ();
Sda. The Fill (table);

ComboBox1. The DataSource=table;
for (int i=0; I & lt; 242; I++)
{
String XSMC.=the table Rows [MainInterface inheritannum] [I + 8]. The ToString ();
ComboBox1. Items. The Add (XSMC);
}

I write so, after the operation shows the five system. Data. Datarowview, I see online combobox is shows the column data, cannot display line data? Only one by one manually to knock?

CodePudding user response:

Can the SQL transfer data row

CodePudding user response:

This.com boBox1. The DataSource=table;//set the ComboBox data
This.com boBox1. DisplayMember=;//let the ComboBox display column
This.com boBox1. ValueMember=;//let the ComboBox practical value for the column
  •  Tags:  
  • C#
  • Related