matt09524 Posted October 16, 2005 Posted October 16, 2005 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... Quote
Leaders snarfblam Posted October 17, 2005 Leaders Posted October 17, 2005 Your biggest problem is that you never set rc to anything. Quote [sIGPIC]e[/sIGPIC]
matt09524 Posted October 17, 2005 Author Posted October 17, 2005 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. Quote
matt09524 Posted October 17, 2005 Author Posted October 17, 2005 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() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.