error when commiting the row to the original data store(urgent)
-
i am having this error when i am about to delete a data row inline with this is a message box saying: object reference not set to an instance of an object. do you want to correct the value? if i click yes, it will delete the row if no it will ignore the deletion i've already checked all of my declarations and pretty sure that i've declared everything right. here's my code: Private Sub delCol_ButtonColumnClick(ByVal sender As Object, ByVal e As Leadit.ExtendedDataGrid.ButtonColumnEventArgs) Handles delCol.ButtonColumnClick Dim row As Integer Dim hourdiffBtn As Integer Dim sBtn As DateTime Dim eBtn As DateTime Dim res As MsgBoxResult row = Me.dtgCustomSched.CurrentRowIndex res = MsgBox("Are you sure you want to delete the schedule on " + Me.dtgCustomSched.Item(row, 0), MsgBoxStyle.YesNo) If res = MsgBoxResult.Yes Then sBtn = Date.Parse(Me.dtgCustomSched.Item(row, 1)) eBtn = Date.Parse(Me.dtgCustomSched.Item(row, 2)) hourdiffBtn = getHrValue(sBtn, eBtn) lastRowNumber = lastRowNumber - 1 Me.remainingHour2 = Me.remainingHour2 + hourdiffBtn Me.txtLookUpHours.Text = remainingHour2.ToString addSchedule.Table("ttcpcustomizedschedule").Rows.RemoveAt(row) Else Exit Sub End If End Sub dtgcustomsched is the name of my datagrid addsched is the name of the dataset i made one of the datagrid cell as a customized button.. it already work fine with my other codes.. the problem only occur here the error occurs on the line in bold. also, this error only appears when i delete the last row on the datagrid, but if i delete anything rather than the last row everything works fine and no error is being detected please help. thanx! i am using vb.net 2002
-
i am having this error when i am about to delete a data row inline with this is a message box saying: object reference not set to an instance of an object. do you want to correct the value? if i click yes, it will delete the row if no it will ignore the deletion i've already checked all of my declarations and pretty sure that i've declared everything right. here's my code: Private Sub delCol_ButtonColumnClick(ByVal sender As Object, ByVal e As Leadit.ExtendedDataGrid.ButtonColumnEventArgs) Handles delCol.ButtonColumnClick Dim row As Integer Dim hourdiffBtn As Integer Dim sBtn As DateTime Dim eBtn As DateTime Dim res As MsgBoxResult row = Me.dtgCustomSched.CurrentRowIndex res = MsgBox("Are you sure you want to delete the schedule on " + Me.dtgCustomSched.Item(row, 0), MsgBoxStyle.YesNo) If res = MsgBoxResult.Yes Then sBtn = Date.Parse(Me.dtgCustomSched.Item(row, 1)) eBtn = Date.Parse(Me.dtgCustomSched.Item(row, 2)) hourdiffBtn = getHrValue(sBtn, eBtn) lastRowNumber = lastRowNumber - 1 Me.remainingHour2 = Me.remainingHour2 + hourdiffBtn Me.txtLookUpHours.Text = remainingHour2.ToString addSchedule.Table("ttcpcustomizedschedule").Rows.RemoveAt(row) Else Exit Sub End If End Sub dtgcustomsched is the name of my datagrid addsched is the name of the dataset i made one of the datagrid cell as a customized button.. it already work fine with my other codes.. the problem only occur here the error occurs on the line in bold. also, this error only appears when i delete the last row on the datagrid, but if i delete anything rather than the last row everything works fine and no error is being detected please help. thanx! i am using vb.net 2002
cutequencher wrote:
addSchedule.Table("ttcpcustomizedschedule").Rows.RemoveAt(row)
Most likely problem is that the Table call is returning null/nothing. Something sure is.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
cutequencher wrote:
addSchedule.Table("ttcpcustomizedschedule").Rows.RemoveAt(row)
Most likely problem is that the Table call is returning null/nothing. Something sure is.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
maybe youre right but im confuse because when i click yes it continue to delete the row but with that error mesage. ive read some thread and says that its a bug on vb.net 2002 datagrid, but then i still need to resolve it, i just wonder if there is a way to disable the autocommit of datagrid? thanx!