Solved

BindingSource error

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

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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 …

773 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