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
helpquestion
6 Posts 3 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. please help me about this. thanx!

    T 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. please help me about this. thanx!

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      Normally this error acurs when you are accessing a variable that hasn't been initialized yet for instance dim s as datatable s.delete... ' this will give your error s = new datatable... The right way would be dim s as datatable s= new datatable... s.delete... the best way to check if this is the case is asinging a stander value to your variables and then try it again if you still get te error something else is going on

      C 1 Reply Last reply
      0
      • T Tom Deketelaere

        Normally this error acurs when you are accessing a variable that hasn't been initialized yet for instance dim s as datatable s.delete... ' this will give your error s = new datatable... The right way would be dim s as datatable s= new datatable... s.delete... the best way to check if this is the case is asinging a stander value to your variables and then try it again if you still get te error something else is going on

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

        it has nothing to do with the declaration... ive just mentioned that i already checked the declaration. it has something to do with the datagrid, its properties and errors bound to it. but thanx anyway.

        D 1 Reply Last reply
        0
        • C cutequencher

          it has nothing to do with the declaration... ive just mentioned that i already checked the declaration. it has something to do with the datagrid, its properties and errors bound to it. but thanx anyway.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          OK. You're calling a method or setting/reading a property on what you think is a valid object that isn't actually pointing to an instance of an object. In other words, you're trying to do something like Nothing.Method(params). Obviously, Nothing, or null in C# doesn't have any methods or properties, so this will throw the message you're talking about. There is nothing wrong with the DataGrid that will cause this problem. It's being thrown by code you wrote. Perhaps you're calling a method on an object your code is assuming exists, probably as a return value from a method, or as an object in a collection where the collection doesn't have any objects in it, when it should be checking for the existance of an object before it tries to use it.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          C 1 Reply Last reply
          0
          • D Dave Kreskowiak

            OK. You're calling a method or setting/reading a property on what you think is a valid object that isn't actually pointing to an instance of an object. In other words, you're trying to do something like Nothing.Method(params). Obviously, Nothing, or null in C# doesn't have any methods or properties, so this will throw the message you're talking about. There is nothing wrong with the DataGrid that will cause this problem. It's being thrown by code you wrote. Perhaps you're calling a method on an object your code is assuming exists, probably as a return value from a method, or as an object in a collection where the collection doesn't have any objects in it, when it should be checking for the existance of an object before it tries to use it.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

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

            ok i get it... but how could i resolve the problem? i am trying to catch the error but the try and catch does'nt work with it. thanx!

            D 1 Reply Last reply
            0
            • C cutequencher

              ok i get it... but how could i resolve the problem? i am trying to catch the error but the try and catch does'nt work with it. thanx!

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              The problem is going to be in either the code that setup the DataAdapter or TableAdapter that you're using, or in the code you're using to do the Update. Without seeing any of this code, it's impossible for anyone to tell you what's wrong.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              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