Using OpenfileDialog and combobox controls in Datagridview cell.  
Author Message
Nonu_k





PostPosted: Windows Forms Data Controls and Databinding, Using OpenfileDialog and combobox controls in Datagridview cell. Top

Hi,

I want a DataGridView to have 2 columns named Key and Value.Some rows should have the Value column to be a ComboBox and another row to have Value Column as OpenFileDialog and the rest to be textbox.The values in the combo box are predefined and the rows are also predefined. Below is the sample.

Key Value

1. SampleKey1 SampleValue1 (CellStyle:TextBox)

2. SampleKey2 true (CellStyle:ComboBox with items as true,false)

3. SampleKey3 Folder Path (CellStyle: OpenFileDialog)

4. SampleKey4 SampleValue4 (CellStyle: TextBox)

- ---- (CellStyle: TextBox)

- ---- (CellStyle: TextBox)

- --- (CellStyle: TextBox)

Please provide the help on the same.



Windows Forms26  
 
 
Wang Chi





PostPosted: Windows Forms Data Controls and Databinding, Using OpenfileDialog and combobox controls in Datagridview cell. Top

For the comboboxcell, you may try

dgvr[x,y] = new DataGridViewComboboxCell();

((DataGridViewComboBoxCell)dgvr[x,y]).Items.Add(object);