469,602 Members | 1,765 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

"object reference not set to an instance of an object" error message - C# app

69
Hello all,

I'm hoping somebody can help me with this.

I have an app that I've been developing in MS Visual Studio 2005 Pro, C#. I have connectivity to a SQL server database. All of the sudden, whenever I try to add a new or change an existing data binding to a text box (as an example), it gives me the error, "object reference not set to an instance of an object".

To clarify... this error occurs when I click on the "text" or "tag" field in the data bindings properties... so I don't even get a chance to try to change it because the error pops up as soon as I click on the property.

My app still compiles and runs fine as is... I just can't change the data binding for any controls, or add any new data bindings. Does anyone know what the heck is going on?

Also... I've already done a "clean" and a recompile on the project and that didn't help. I also installed service pack 2 hoping it would help, but to no avail.

Any help will be greatly appreciated.
Jan 3 '08 #1
11 7097
balabaster
797 Expert 512MB
Hello all,

I'm hoping somebody can help me with this.

I have an app that I've been developing in MS Visual Studio 2005 Pro, C#. I have connectivity to a SQL server database. All of the sudden, whenever I try to add a new or change an existing data binding to a text box (as an example), it gives me the error, "object reference not set to an instance of an object".

To clarify... this error occurs when I click on the "text" or "tag" field in the data bindings properties... so I don't even get a chance to try to change it because the error pops up as soon as I click on the property.

My app still compiles and runs fine as is... I just can't change the data binding for any controls, or add any new data bindings. Does anyone know what the heck is going on?

Also... I've already done a "clean" and a recompile on the project and that didn't help. I also installed service pack 2 hoping it would help, but to no avail.

Any help will be greatly appreciated.
Just to clarify...the issue is in design mode in the IDE not at runtime?
Jan 3 '08 #2
narpet
69
Just to clarify...the issue is in design mode in the IDE not at runtime?
That is correct. The app compiles, publishes and runs just fine. Everything was fine until about 3 days ago, when this problem started out of nowhere.
Jan 4 '08 #3
Plater
7,872 Expert 4TB
Did you recently delete a databindingsource or anything?
I would suggest looking into the designer code and see if you see anything funky?
Also, sometimes closing out of the program entirely(not just the project/solution) and re-opening it works.
Jan 4 '08 #4
narpet
69
Did you recently delete a databindingsource or anything?
I would suggest looking into the designer code and see if you see anything funky?
Also, sometimes closing out of the program entirely(not just the project/solution) and re-opening it works.
I've closed Dev Studio several times... even rebooted my machine.

I haven't deleted any databidingsources... and even when I try to change a control that has a valid bindingsource it gives me that error. I will look at the designer code and see if I can find anything.

If you have any other ideas, I would really appreciate it. This is about 3 months of work on a new applicaiton that will be replacing outdated MS Access apps. If I lose all of my work due to the fact that I can't move forward, that will be very bad (as you can imagine).

Thanks for the help!
Rod
Jan 4 '08 #5
narpet
69
I really need some help on this... if anyone has any other ideas I would really appreciate it.

Thanks,
Rodney
Jan 8 '08 #6
Plater
7,872 Expert 4TB
Only other thing I can think of is that you added another class to the code file for the form page (where it puts all the event handlers and stuff) as that throws off the designer big time.

Also, since it uses "partial" classes, I think it's possible for one to get renamed/mangled and the other to appear fine. You could check that maybe?

generally in these situations, I find it's better to create a completely new file and copy/paste into it.
Jan 8 '08 #7
narpet
69
Only other thing I can think of is that you added another class to the code file for the form page (where it puts all the event handlers and stuff) as that throws off the designer big time.

Also, since it uses "partial" classes, I think it's possible for one to get renamed/mangled and the other to appear fine. You could check that maybe?

generally in these situations, I find it's better to create a completely new file and copy/paste into it.
Thanks... I will look at it and see if I can find anything out of place. I didn't add any new classes... but I will go through the code to see if I can find anything.

Thanks again!
Jan 8 '08 #8
I am experiencing exactly the same problem. Your description could have been written by me. My problem started just a few days ago and I can't think of anything unusual I did to cause it. Right now, I am unable to proceed.
Mar 6 '08 #9
I don't know if anyone is still following this thread, but just in case, I wanted to post my solution. The problem was that my project file still contained a reference to a datasource (class) I had created and deleted. When I deleted the class after deciding not to use it, it didn't occur to me to go to the project file and delete the reference.
Mar 7 '08 #10
Plater
7,872 Expert 4TB
I don't know if anyone is still following this thread, but just in case, I wanted to post my solution. The problem was that my project file still contained a reference to a datasource (class) I had created and deleted. When I deleted the class after deciding not to use it, it didn't occur to me to go to the project file and delete the reference.
That solution was mentioned as a possibility above.
Mar 7 '08 #11
Hello, I'm having the same issue when I click on the bindings text property and I am getting this error on every form in the project.
I have opened up my databindings folder and walked through all datasources and all have an object in the project. Is there something else I need to do? Is there a utility that does some kind of cleanup? I have too many datasources and forms to recreate them. Thanks for any help you can give.
Rob
Feb 12 '09 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by chuckdfoster | last post: by
7 posts views Thread by dhnriverside | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.