ComBox控件的使用

conn.Open();
OleDbDataAdapter myDA2
= new OleDbDataAdapter( " select * from Grade " , conn);
myDA2.Fill(ds,
" table " );
//绑定combox数据源
comboBox1.DataSource
= ds.Tables[ " table " ];
comboBox1.ValueMember
= " Grade_ID " ;
comboBox1.DisplayMember
= " Grade_Name " ;

conn.Close();

int k = int .Parse( this .comboBox1.SelectedValue.ToString());//获取combox的选中值

你可能感兴趣的:(combox)