Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
15405 | Jun 17,2004 09:59 AM UTC | Jun 21,2004 04:14 AM UTC | WinForms | 9 |
![]() |
Tags: GridControl |
Dim cmSource As CurrencyManager = CType(Me.BindingContext(Me.dvExtraItems), CurrencyManager)
try something like this (assuming Me.dvExtraItems is set to be the StyleInfo.DataSource for this column).
Dim bc as BindingContext = Me.grid.Model.CellModels("ComboBox").BindingContext
Dim cmSource As CurrencyManager = CType(bc(Me.dvExtraItems), CurrencyManager)
In 1.6.1.8, there was a problem where in some circumstances the BindingContext of a cell combobox was not being set early enough. Because of this problem, in 2.0, the grid makes sure the BindingContext is set by forcing it to a new BindingContext in these situations. This means that if you want other controls on the form to be in sync with the grid''s embedded combobox, you must somehow ensure they are all using the same BindingContext.
If this does not work, if you can post a sample project showing the problem, maybe we can spot the problem.
Dim cr As GridComboBoxCellRenderer = Me.GDBG1.CurrentCell.Renderer
Dim drvSource As DataRowView = Me.dvExtraItems(cr.ListBoxPart.SelectedIndex)
MsgBox("value of the selectedindex = " & cr.ListBoxPart.SelectedIndex & vbCrLf & _
"the value of itemDescription = " & drvSource("itemDescription"))
Me.GDBG1.CurrentCell.ConfirmChanges()
Me.GDBG1.Binder.EndEdit()
One other comment on what happens when you do this. You will notice the grid looks like it adds one extra row and then removes it. You can avoid this flash by changing this grid property.
Me.GDBG1.CurrentCell.ConfirmChanges(). This is set to true by default in the designer generated code. I think setting it false will avoid the extra row flash.
Me.GDBG1.OptimizeInsertRemoveCells = False
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.