Problem(Please Help)

  • Thread starter Thread starter scorpion53061
  • Start date Start date
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()
 
Figured it out..........

There was nothing wrong with the code except when I disabled controls during
a particular operation it would have been helpful if I had remembered to
turn them back on.......

:(
 
OK, at least you solved it.

Regards - OHM#
Figured it out..........

There was nothing wrong with the code except when I disabled controls
during a particular operation it would have been helpful if I had
remembered to turn them back on.......

:(

Regards - OHM# (e-mail address removed)
 
Back
Top