C++开发博客CSDN

DataGridViewComboBoxColumn的使用

            DataGridViewComboBoxColumn ComboBoxColumn = new DataGridViewComboBoxColumn();

            ComboBoxColumn.DataSource 
=  Datatable对象(combobox要绑定的数据,包含两个列一个DisplayMember ,
                                          一个ValueMember  )
            ComboBoxColumn.DisplayMember = "Display";
            ComboBoxColumn.ValueMember 
= "Value";

            ComboBoxColumn.DataPropertyName 
= "Feild";//datagridview1的DataSource,数据库中的列
            ComboBoxColumn.HeaderText 
= "单据种类";
            ComboBoxColumn.DisplayStyle 
= DataGridViewComboBoxDisplayStyle.Nothing;
            ComboBoxColumn.FlatStyle 
= FlatStyle.System;

            
this.datagridview1.Columns.Add(ComboBoxColumn);     
posted @ 2011-07-12 08:51  纳凉亭子  阅读(318)  评论(0编辑  收藏  举报