Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. error when commiting the row to the original data store(urgent)

error when commiting the row to the original data store(urgent)

Scheduled Pinned Locked Moved Visual Basic
helpcsharpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cutequencher
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • C cutequencher

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      C 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        C Offline
        C Offline
        cutequencher
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups