自定义Combobox数据

自定义Combobox数据
  private   void  setNormalFinanciaData()
        { 
            DataTable dtList 
=   new  DataTable();
            dtList.Columns.Add(
new  DataColumn( " text " typeof ( string )));
            dtList.Columns.Add(
new  DataColumn( " value " typeof ( string )));
            dtList.Rows.Add(dtList.NewRow());
            dtList.Rows.Add(dtList.NewRow());
            dtList.Rows.Add(dtList.NewRow());
            dtList.Rows.Add(dtList.NewRow());
            dtList.Rows[
0 ][ 0 =   " aaa " ;
            dtList.Rows[
0 ][ 1 =   " 001 " ;
            dtList.Rows[
1 ][ 0 =   " bbb " ;
            dtList.Rows[
1 ][ 1 =   " 002 " ;
            dtList.Rows[
2 ][ 0 =   " ccc " ;
            dtList.Rows[
2 ][ 1 =   " 003 " ;
            dtList.Rows[
3 ][ 0 =   " ddd " ;
            dtList.Rows[
3 ][ 1 =   " 004 " ;

            cmbFinancial.DataSource 
=  dtList;
            cmbFinancial.DisplayMember 
=   " text " ;
            cmbFinancial.ValueMember 
=   " value " ;
        }






你可能感兴趣的:(自定义Combobox数据)