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. please help me about this. thanx!
-
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!
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
-
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
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.
-
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.
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
, ornull
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 -
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
, ornull
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, 2007ok 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!
-
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!
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