Solved

BindingSource error

Posted on 2012-03-22
2
370 Views
Last Modified: 2012-03-22
hi,

I get a compilation error in the follwoing code.

errors:
Error      1      An object reference is required for the non-static field, method, or property 'System.Windows.Forms.BindingSource.DataMember.get'

Error      2      An object reference is required for the non-static field, method, or property 'System.Windows.Forms.BindingSource.DataSource.get'

code:
 private void Form1_Load(object sender, EventArgs e)
        {
            DBO db = new DBO();
            BindingSource.DataMember = "Sample";
            BindingSource.DataSource = db;
            this.reportViewer1.RefreshReport();

        }

How can I solve the problem?

Please help

ayha
0
Comment
Question by:ayha1999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 37754631
You don't seem to have initialized your bindingsource properly :
private BindingSource binding1;
 private void Form1_Load(object sender, EventArgs e)
        {
            DBO db = new DBO();
            binding1 = new BindingSource();
            binding1.DataMember = "Sample";
            binding1.DataSource = db;
            this.reportViewer1.RefreshReport();

        }

Open in new window

0
 
LVL 7

Author Closing Comment

by:ayha1999
ID: 37754734
Thanks
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question