We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GDBG Error

1) I have initialized my column as GDBG1.Model.ColStyles(1).CellType = "ComboBox" and GDBG1.Model.ColStyles(1).DropDownStyle = Exclusive 2) Then in CurrentCellShowingDropDown, I set the Datasource with a DataTable that changes every time. Dim cr As GridComboBoxCellRenderer = CType(cc.Renderer, GridComboBoxCellRenderer) '' If Not (cr Is Nothing) Then If cr.ListBoxPart.DataSource Is Nothing Then cr.ListBoxPart.DataSource = GetNewDataTable cr.ListBoxPart.DisplayMember = "Name" cr.ListBoxPart.ValueMember = "Name" End If End If 3. When trying to enter a value in this column, as soon as I hit the keyboard, I get this error. What am I doing wrong. Help me!. Thanks, Bits Getting the following exception: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Grid.GridComboBoxListBoxHelper.GetItemCount() at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.SyncControlValue(Int32 index) at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.set_TextBoxText(String value) at Syncfusion.Windows.Forms.Grid.GridTextBoxCellRenderer.SetTextBoxText(String s, Boolean validate) at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.SetComboBoxText(String s, Boolean validate, Int32 index) at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.OnKeyPress(KeyPressEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.ProcessKeyEventArgs(Message& m) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseProcessKeyEventArgs(Message& m) at Syncfusion.Windows.Forms.Grid.GridControlBase.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.Control.ProcessKeyMessage(Message& m) at Syncfusion.Windows.Forms.Grid.GridControlBase.ProcessKeyMessage(Message& m) at System.Windows.Forms.Control.WmKeyChar(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.RunDialog(Form form) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at System.Windows.Forms.Form.ShowDialog() at CCM.frmExplorer.LoadSchedulerForm() in C:\Citi\VB.Net\DEV\CCMKERNEL\frmExplorer.vb:line 7238 at CCM.frmExplorer.mnuPopExplorerSchedule_Click(Object sender, EventArgs e) in C:\Citi\VB.Net\DEV\CCMKERNEL\frmExplorer.vb:line 7244

4 Replies

AD Administrator Syncfusion Team January 28, 2005 06:40 AM UTC

Two things. In a GridDataBoundGrid, you initialize column styles using the GirdBoundColumn objects for the column (actually, the GridBoundColumn.StyleInfo objects). You get these objects either from grid.GridBoundColumns or grid.Binder.InternalColumns depending upon whether you have explicitly set up GridBoundColumns or not. Also, I do not think you will get the CurrentCellShowingDropdown event if the DataSource is nothing (as the grid thinks there is nothing to drop). So, you should try setting some DataSource/DisplayMember/ValueMember in the GridBoundColumn.StyleInfo object to start with. Then in CurrentCellShowingDropDown, do not check whether cr.ListBoxPart.DataSource is Nothing. You could just change it, or you could check if the current DataSource is not what you want it to be, and then change it if necessary.

AD Administrator Syncfusion Team January 28, 2005 01:29 PM UTC

Clay, You are Great! It worked like a charm. :) Now I wonder, is this the correct method to access cellvalue in GDBG. Me.GDBG(cc.RowIndex, GDBG.Model.NameToColIndex("ColName")).CellValue.ToString Thanks a lot, Bits.

AD Administrator Syncfusion Team January 28, 2005 01:57 PM UTC

As long as the particular cell is not being actively edited, then your code should be OK. If the cell is being edited, your code would return the old value and not necessarily the new value. In this case, you can use grid.CurrentCell.Renderer.ControlText to get the text from the currently editing cell.

AD Administrator Syncfusion Team January 28, 2005 04:05 PM UTC

Thanks a lot. :)

Live Chat Icon For mobile
Up arrow icon