S
scorpion53061
Ok boiled down this is the problem.........
in a module I declare a dataset.
Public dscopy as new dataset 'generic dataset
Public chitem as String 'item being selected
Public newcol as DataColumn 'generic datacolumn
In the form I fill a dataset called dsfavorites1 and then do this:
dscopy = dsfavorites1.Copy
newcol = Dsfavorites1.Tables(0).Columns("ITEMNO")
dscopy now contains the data and structure of dsfavorites1.
in the datagrid click event I say
Dim i as Integer
chitem = DataGrid1.Item(DataGrid1.CurrentCell)
For i = 0 To dscopy.Tables(0).Rows.Count - 1
If chitem =
dscopy.Tables(0).Rows(itemcheck).Item(newcol.ColumnName) Then
Label3.Text = chitem
Else
Exit Sub
everything seems fine until I go to click another button. THen I get this
prompt....
This exception occured while running in the development environment. The
debugger didnt catch it though it appeared as a message box
prompt
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.DataGrid.AddNewRow()
at System.Windows.Forms.DataGridAddNewRow.OnEdit()
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
in a module I declare a dataset.
Public dscopy as new dataset 'generic dataset
Public chitem as String 'item being selected
Public newcol as DataColumn 'generic datacolumn
In the form I fill a dataset called dsfavorites1 and then do this:
dscopy = dsfavorites1.Copy
newcol = Dsfavorites1.Tables(0).Columns("ITEMNO")
dscopy now contains the data and structure of dsfavorites1.
in the datagrid click event I say
Dim i as Integer
chitem = DataGrid1.Item(DataGrid1.CurrentCell)
For i = 0 To dscopy.Tables(0).Rows.Count - 1
If chitem =
dscopy.Tables(0).Rows(itemcheck).Item(newcol.ColumnName) Then
Label3.Text = chitem
Else
Exit Sub
everything seems fine until I go to click another button. THen I get this
prompt....
This exception occured while running in the development environment. The
debugger didnt catch it though it appeared as a message box
prompt
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.DataGrid.AddNewRow()
at System.Windows.Forms.DataGridAddNewRow.OnEdit()
at System.Windows.Forms.DataGrid.Edit(String instantText)
at System.Windows.Forms.DataGrid.Edit()
at System.Windows.Forms.DataGrid.OnEnter(EventArgs e)
at System.Windows.Forms.Control.NotifyEnter()
at System.Windows.Forms.ContainerControl.UpdateFocusedControl()