![]() |
Click here to advertise with us
|
|
|||||||
| Winforms Grids Discussion related to grid controls of all types for Winforms |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Is there a way of giving a cell a drop down combobox with a small number of choices in it, eg. choosing a currency symbol? In VB6 there was BuildCombo etc.
Thank you. |
|
|||
|
Copied from a recent post by JohnH :-
Code:
Dim cell As New DataGridViewComboBoxCell
cell.Items.Add("A")
cell.Items.Add("B")
Me.DataGridView1.Item(col, row) = cell
|
|
||||
|
Just add a Combobox column to the DataGridView when you configure its columns.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
This will be for all cells in a given column, except where there is no value in column 2 in that row (for example).
Eg. column 8 has the ComboBox if column 2 is valid. |
|
|||
|
Sorry, my mistake then - I took "giving a cell a drop down combobox" at its literal meaning.
|
|
|||
|
Sorry, I should have explained it better to begin with.
I have a datagrid in VB 2005, where each cell in column 8 is a combobox contain currency symbols eg. £, €, $. When the user enters any cell in this column, they are forced to accept one of the currency symbols, and not to type in something else. I tried HTML Code:
Dim cell As New DataGridViewComboBoxCell
cell.Items.Add("A")
cell.Items.Add("B")
Me.grd1.Item(grd1.CurrentCellAddress.X, grd1.CurrentCellAddress.Y) = cell
Where should I put the code, for best results? Thank you. |
|
||||
|
As I said, just add a combo column in Designer. You can also add the items there.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|