Hi All,
i am trying to use an ExtendedDatagrid
(
http://dotnet.leadit.be/extendeddatagrid/CategoryView.aspx?category=Home)
to display data from a DataSet. However it returns an exception during
Paint. It won't happen when the data source is my self defined Object() as
at the VB
Sample(
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGui d=00c91f95-c6f2-415d-a69e-77eef1418d0a)
Does anyone know what should i be aware when working the extendeddatagrid
with a dataset.
Thx in Advance
Regards,
Norton
Here is the Source Code
'-----------------
Private Sub Form_load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim oProgressControl As MyProgressControl1 = New MyProgressControl1
Me.SqlDataAdapter1.Fill(Me.OUserDS1)
ExtendedDataGrid1.DataSource = Me.OUserDS1.ACM_User
Dim oTableStyle As
Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle = New
Leadit.ExtendedDataGrid.ExtendedDataGridTableStyle
oTableStyle.MappingName = "ACM_User"
oTableStyle.DataGrid = Me.ExtendedDataGrid1
Dim NameCol As DataGridTextBoxColumn = New DataGridTextBoxColumn
NameCol.MappingName = "UserName"
NameCol.HeaderText = "UserName"
NameCol.Width = 75
NameCol.ReadOnly = True
oTableStyle.GridColumnStyles.Add(NameCol)
Dim ImportanceCol As
Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn = New
Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn
ImportanceCol.Control = oProgressControl.GetType
ImportanceCol.MappingName = "UserID"
ImportanceCol.HeaderText = "UserID"
oTableStyle.GridColumnStyles.Add(ImportanceCol)
ExtendedDataGrid1.TableStyles.Add(oTableStyle)
End Sub
and The Error Message
'------------------------------------------------
An unhandled exception of type 'System.ApplicationException' occurred in
leadit.extendeddatagrid.dll
Additional information: Exception in SetDataGridInColumn.
Unhandled Exception: System.ApplicationException: Exception in
SetDataGridInColumn. ---> System.NullReferenceException: Object reference
not set to an instance of an object.
at
Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn.SetDataGridInColumn(Da
taGrid value)
--- End of inner exception stack trace ---
at
Leadit.ExtendedDataGrid.ExtendedDataGridControlColumn.SetDataGridInColumn(Da
taGrid value)
at
System.Windows.Forms.DataGridColumnStyle.SetDataGridTableInColumn(DataGridTa
bleStyle value, Boolean force)
at
System.Windows.Forms.GridColumnStylesCollection.Add(DataGridColumnStyle
column)
at MyDataGrid2.Form1.Form_load(Object sender, EventArgs e) in
D:\SourceCode\TestProject\MyDataGrid2\Form1.vb:line 168
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
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.SafeNativeMethods.ShowWindow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
The program '[2852] MyDataGrid2.exe' has exited with code 0 (0x0).
at System.Windows.Forms.Application.Run(Form mainForm)
at MyDataGrid2.Form1.Main() in
D:\SourceCode\TestProject\MyDataGrid2\Form1.vb:line 1