Solved

BindingSource error

Posted on 2012-03-22
2
369 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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