Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I get an "object reference not set to an instance of an object" error when trying to use control. Not sure what's going on, any ideas?

 

Private Sub addbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addbutton.Click
       Dim rc As DataRowCollection
       Dim newrow As DataRow
       Dim nrc(15) As Object
       nrc(0) = ""
       nrc(1) = ""
       nrc(2) = ""
       nrc(3) = ""
       nrc(4) = ""
       nrc(5) = ""
       nrc(6) = ""
       nrc(7) = ""
       nrc(8) = ""
       nrc(9) = ""
       nrc(10) = ""
       nrc(11) = ""
       nrc(12) = ""
       nrc(13) = ""
       nrc(14) = ""
       newrow = rc.Add(nrc) ' <----- Object reference not set...

Posted

I have come into this problem throughout my adventure with this project. I am trying to not use the database wizard at all and because of that, I am forced to learn new stuff. I tried adding:

 

rc = dbdatacc.table.Rows

 

But it won't recognize "table" which is what I have been using as the datamember for all my binding. I tried using the table name, but aparently it doesn't recognize it. I don't have any problems binding or displaying the data, so I don't know what to do here.

Posted

Found an easier way to do this:

 

Dim myDataRowsCommandBuilder As OleDbCommandBuilder = New OleDbCommandBuilder(DbAdaptCC)
       Dim dr As DataRow
       dr = DbDataCC.Tables("table").NewRow()
       DbDataCC.Tables("table").Rows.Add(dr)
       Save()
       DbDataCC.Clear()
       DbAdaptCC.Fill(DbDataCC)
       Count()

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...