Tôi còn phải làm gì khác để hiển thị ReadAccess
thành viên enum trong DatagridViewComboBox này?Làm thế nào để hiển thị các thành viên loại Enum trong một DataGridViewComboBox?
ReadDataGridViewComboBoxColumn.Items.Clear();
ReadDataGridViewComboBoxColumn.Items.AddRange(ReadAccess.None, ReadAccess.Allowed);
ReadDataGridViewComboBoxColumn.ValueType = typeof(ReadAccess);
đây là mã thiết kế tạo về DataGridView:
this.rolesDataGridView.AutoGenerateColumns = false;
this.rolesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.TableNameDataGridViewTextBoxColumn,
this.ReadDataGridViewComboBoxColumn,
this.WriteDataGridViewComboBoxColumn,
this.ReadCodeDataGridViewComboBoxColumn,
this.ProcessDataGridViewCheckBoxColumn,
this.AdministrateDataGridViewCheckBoxColumn});
this.rolesDataGridView.DataSource = this.bsTablePermissions;
và cuối cùng, trong khi InitializeComponent();
, tôi đang thiết DataGridView của DataSource:
this.rolesDataGridView.DataSource = this.RoleTablePermissions; // a bindingsource list
Bạn đã thực hiện 'this.Controls.Add (ReadDataGridViewComboBoxColumn)' hoặc tương tự? –
@George: vâng, chắc chắn ... nhưng khi tôi chạy dự án, hộp kết hợp bị đóng băng và tôi không thể mở danh sách của nó ... –
Có mã nào khác để khởi tạo DataGridView không? –