Home › Forums › WinForms controls › Xceed Grid for WinForms › Problem with ComboBox
-
AuthorPosts
-
#12827 |
Hi friends,
I have 2 columns in my grid to which i have attached the GridComboBox as the CellViewer and CellEditor…when i add a new record using insertion row i get the combo but rather than displaying the displaymember the cell displays the value…any idea what could be wrong…sample code for first column
Dim cboZones As Xceed.Grid.Editors.GridComboBox = New GridComboBox
Dim gccNew As Column
gccNew = New Column(“DepotZone”, GetType(String))
gccNew.Width = 200
gccNew.CellEditor = cboZones
gccNew.CellViewer = cboZones
gcZones.Columns.Add(gccNew)‘- The source for combo box is a dataview
With cboZones
.DataSource = dvZones
.DisplayMember = “ZoneDescr”
.ValueMember = “ZoneID”
End Withsame with the 2nd column…
Any idea what could be wrong ??
Cheers,
Imported from legacy forums. Posted by Sharad (had 3040 views)
It could be that you are filtering your view somewhere else in the code. I usually create my DataTable or DataView inside the method used to attach it to the GridComboBox. That way, the DataTable or DataView is discarded (i.e. I can’t “mess up” the contents of the combobox).
And yes, the combobox keeps the data. This is true for all comboboxes.If you have to filter the ComboBox for adding purposes, you *must* make sure to remove it as soon as possible. Otherwise, the grid cannot perform the lookup required and will display values instead.
Hope this helps.
MarkImported from legacy forums. Posted by MBonafe (had 357 views)
Hi mark,
Thanks for your help. Quite honestly, i really donno what i did but fortunately i got it working. I was actually creating building the whole grid at runtime with a default groupby which was set to be invisible. So i started with a very complicated code. I got frustrated and so deleted the whole thing and started from scratch, bit by bit and got every piece of code working before i went ahead with the next. And to my joy it worked for me. The code is perfect now. I totally agree with what you said about the filtering of combobox, but it wasn’t the case in my code.
Thanks anyway for your help and suggestion. I look fwd to your help in future..Enjoy the weekend !!
Cheers
Imported from legacy forums. Posted by Sharad (had 4014 views)
-
AuthorPosts
- You must be logged in to reply to this topic.