For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > July 2004 > Datagrid, Dataset and Object reference not set to an instance of an object









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Datagrid, Dataset and Object reference not set to an instance of an object
Francis Shanahan

2004-07-15, 4:00 pm

I'm running Windows XP Pro with all service packs up to date.
I'm using Visual Studio 2003 with a vb.NET windows forms
project. Here's my problem:

#1
I've developed a simple custom datagrid with NO
functionality other than default. When I try to add this
custom control to a form in my application (drag and drop
from the toolbox) I get "Object reference not set to an
instance of an object" and the control is not added.

#2 I tried adding a standard datagrid to my form (which
works) and then modifying the code behind to replace
System.Windows.Forms.Datagrid with MyCustomGrid. This will
compile and run just fine. When I switch back to the
Designer view in Visual Studio the form is not displayed at
all. I just see errors "Object reference not set" etc.

#3 I've tried shutting down VStudio and reopening it, does
not help.

#4 I've created a simple strongly typed dataset in this
same project. The XSD generates a dataset just fine and I'm
using that with my datagrid. HOWEVER when I run the Data
Form Wizard it does not recognize that there is ANY dataset
in the project. It tells me I can only create a new dataset
for the wizard to use. When I do create a dataset in this
manner it adds a new XSD to the project but then will not
allow me to use this new dataset in the Data Form Wizard.

Lastly, this entire codebase works FINE with none of the
above issues on a different machine. This other machine is
running Windows XP Pro and Visual Studio 2003 just like the
problem machine. The only difference is that the working
machine started out life with Visual studio 2002 (I think)
and was upgraded.

Both machines are running version 1.1 of the framework.

Any clues? This is really killing my productivity. I need
to get this working today. Thanks,
-fs

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com