IDE BindingSource error message

F

Flomo Togba Kwele

I used the Data Sources window to drop a custom object onto the designer
surface. It created a BindingSource and BindingNavigator as a result.

When I open the Properties window on the BindingSource, I see DataSource
property set to the object I created. However, when I try to dropdown
the DataSource property, I get the message:

"Object reference not set to an instance of an object". The title of the
messagebox is "Microsoft Visual Studio".

So I cannot change the DataSource! I went into the designer file and
removed the DataSource property of the BindingSource and went back into
the designer. It showed the DataSource as (none) as I expected.

But the same error message occurs when I try to change the property with
the dropdown box.

What is going on?

Thanks Flomo
 
L

Linda Liu [MSFT]

Hi Flomo,

I performed a test based on your description but didn't reproduce the
problem.

The following is the steps of my test.

1. Create a WinForm application project named 'BindingSourceDataSource' and
add a class into the project. Below is the code of the class.
class Person
{
private string id;
private string name;
public string ID
{
get { return id; }
set { id = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
}
2. Add a new Data Source based on the class Person. To do this, select menu
Data|Add New Data Source and select 'Object' in the coming up 'Data Source
Configuration Wizard'. Select the class Person later following the wizard.

3. Drag&Drop Person from the Data Sources window onto the form. This
creates a DataGridView, a BindingNavigator and a BindingSource as a result.

The DataSource property of the BindingSource component is set to
'BindingSourceDataSource.Person' in the Properties window. When I drop down
the DataSource property in the Properties window, there's no error
occurring.

Is there any difference between your project and mine? If so, please point
them out.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
F

Flomo Togba Kwele

Linda,

Thanks for the reply. I knew it was not a normal situation. I suspected
a corrupt project file. Then I read an article in this forum titled
"DataGridView crash when selecting Data Source" which suggested
excluding all the datasources in the project in Solution Explorer under
My Project\Datasources.

I did this and it cleared the problem up. But I can run the app OK. I
don't understand the function of the datasources files. Can you explain?

Thanks
 
L

Linda Liu [MSFT]

Hi Flomo,

Thank you for your response.

Have you solved the problem by excluding all the data sources in the
project?

The xxx.datasource file located under the My Project\DataSources is
generated by VS IDE when a generic object data source is created. This file
is used to store the configuration information of the generic object data
source.

Hope this helps.
If you have any question, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top