Use a ComboBoxCell to update textboxcell on a Binded Datagridview
-
Hello I'm trying to figure out the best way to update TextBoxCell value on a Binded Datagridview The values comes from a list of +/- 1000 allowed value The Dgv is Binded to a datatable I think that it will be too heavy and not necessary to create a ComBoBox column for that dgv But I do not find many information about the use of a single Combobox cell to display "on the fly" when editing a TextBoxCell Thank for any Help N.B. : For now I'm using a ContextMenu with a ComBobox Item
-
Hello I'm trying to figure out the best way to update TextBoxCell value on a Binded Datagridview The values comes from a list of +/- 1000 allowed value The Dgv is Binded to a datatable I think that it will be too heavy and not necessary to create a ComBoBox column for that dgv But I do not find many information about the use of a single Combobox cell to display "on the fly" when editing a TextBoxCell Thank for any Help N.B. : For now I'm using a ContextMenu with a ComBobox Item
Even if you find a suitable way of showing a
ComboBox
'on the fly' I suspect that the time taken to load the +/- 1000 options will be at least as great (as heavy), if not greater than the time taken when using aDataGridViewComboBoxColumn
. From this point of view I cannot see why you do not use a ComboBox column. Or is there some other reason?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Even if you find a suitable way of showing a
ComboBox
'on the fly' I suspect that the time taken to load the +/- 1000 options will be at least as great (as heavy), if not greater than the time taken when using aDataGridViewComboBoxColumn
. From this point of view I cannot see why you do not use a ComboBox column. Or is there some other reason?Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo
-
Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo
A ComboBoxColumn is made up of ComboBoxCells so to get a ComboBoxCell all you have to do is set that Column to be a ComboBoxColumn. Here[^] is a sample using a ComboBoxColumn, work through it and see if it is anywhere near your requirements. Pretty much anything that can be done in code can be done through the designer for DataGridViews. Look here[^] for an example.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Thank You Henry To be honest I've very little experience about using ComboBox on a DataGridView I know that it can be tricky and I don't really know when a ComboBoxCell is suitable instead of a ComboBoxColumn But the constraints here are - The DGV is Binded and normaly I use the AutoGenerate Column - There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited - There is only ONE List for the Combo
I have realized that I haven't answered your other points, I didn't really see them because I thought they were your sig. :)
olibara wrote:
- The DGV is Binded and normaly I use the AutoGenerate Column
Using the 'Data Sources Window' you can set individual database columns to use specific types of DataGridViewColumns. By expanding the tree so that you can see the column of interest, make sure that your form is selected in the designer, go back to Data Sources and select the the column. It should display as a combobox which will list the types of controls that can be used, select the combobox option and away you go. When you drag the DataSource onto your form it will make a grid with a comboboxcolumn.
olibara wrote:
- There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited
The ComboBoxColumn looks like a TextBoxColumn until you edit/select it.
olibara wrote:
- There is only ONE List for the Combo
That is normal.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
I have realized that I haven't answered your other points, I didn't really see them because I thought they were your sig. :)
olibara wrote:
- The DGV is Binded and normaly I use the AutoGenerate Column
Using the 'Data Sources Window' you can set individual database columns to use specific types of DataGridViewColumns. By expanding the tree so that you can see the column of interest, make sure that your form is selected in the designer, go back to Data Sources and select the the column. It should display as a combobox which will list the types of controls that can be used, select the combobox option and away you go. When you drag the DataSource onto your form it will make a grid with a comboboxcolumn.
olibara wrote:
- There is only ONE column editable in the DGV - I want to see normal TextBox cell and make the Combo appears when a cell is edited
The ComboBoxColumn looks like a TextBoxColumn until you edit/select it.
olibara wrote:
- There is only ONE List for the Combo
That is normal.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Thank you Henri I'm sorry to reply so late but I did'nt get the notification of your reply I will investigate because using the Combobox directly in the DGV is far better than my actual solution to set the ComboBox in a contextMenu It is not easy to find good explaination about the different way to use a combobox in a datagridview