Skip to main content

Command Palette

Search for a command to run...

Error when adding new Data Source

Published
1 min read
Error when adding new Data Source
P

Pieter van der Westhuizen, a professional freelance web & mobile developer and founder of Coalition Software.

I’ve experienced the strangest error when I try to add a new datasource via the Data Sources window in Visual Studio. The Data Source Configuration Wizards pops up, I select I want to bind to an object, click on next and get the following error:

![DataSourceError](http://www.mythicalmanmoth.com/wp-content/uploads/2009/10/datasourceerror-thumb.gif "DataSourceError")
(Click to view larger image)

Yes, the dreaded Object reference not set to an instance of an object error.

After a considerable amount of time spent checking references, adding references, re-building and a lot of profanity, I finally discovered that VS expects a class in the root of your project for the Data Source Configuration Wizard to bind to an object. I moved all my forms and classes to folders within my project, thus I had no classes in the root of my project.

After creating an empty Class1.vb in the root of my project the error went away.

Go figure!!

More from this blog

M

Mythical Man Moth

80 posts

Hi, I’m Pieter van der Westhuizen. I'm a professional freelance web & mobile developer from South Africa that has been code slinging for more than 23 years. https://youtube.com/shorts/aCCKAnDNrzM