Solved

calling a method on the main form from a usercontrol in a WinForm

Posted on 2013-02-06
1
493 Views
Last Modified: 2013-02-06
I have a uercontrol - in that usercontrol I want to can a meathod to initiate the repeater control
int the user control i am calling the main page and the meathod
 MainView mv = FindForm() as MainView;
                    if (mv != null)
                        mv.ButtonRepeater();

Open in new window

in the main page I am calling the repeater
        internal void ButtonRepeater(object sender, EventArgs e)
        {
            ButtonRepeater();
        }

Open in new window


and when it runs I get an error - the error is "This causes two bindings in the collection to bind to the same property.
Parameter name: binding"

        public void ButtonRepeater()
        {
            if (DesignMode == false)
            {
                radLabel3.Text = "";
                dataRepeater1.DataSource = null;
                BindingSource bindingSource1 = null;
                DataTable dt = null;
                string sqlStr = "";
                string sqlCon = ConfigurationManager.ConnectionStrings["ViewCon"].ToString();
                sqlStr += " SELECT  id, TaskUID, Factory, ItemNumber, ItemName, ExFactoryDate, Customer, ReportDate, InspectorName, BatchCode, OverallResultChina, OverallResultDallas, ";
                sqlStr += " IsDupro, IsFinalRandomInsp, IsTestSamplePull, Uploaded, Downloaded, PDS_CC, WorkmanShip, OnSiteTest, BarcodeVer, Packaging, Packing, Lbl_Print_Mrkg, ";
                sqlStr += " ShipRemarks, IsCOmplete "; 
                sqlStr += " FROM         QC_Inspection ";
                sqlStr += " WHERE     (IsCOmplete IS NULL or IsCOmplete = 0 ) ";
                using(SqlConnection conn = new SqlConnection(sqlCon))
                using(SqlCommand cmd = new SqlCommand(sqlStr,conn))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection.Open();
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    dt = new DataTable();
                    da.Fill(dt);
                    bindingSource1 = new BindingSource();
                    bindingSource1.DataSource = dt;
                    radLabel2.Text = "QC Inspection";
                    radLabel3.DataBindings.Add("Text", bindingSource1, "TaskUID");<<<Error<<<<<
                    radLabel4.DataBindings.Add("Text", bindingSource1, "Factory");
                    dataRepeater1.DataSource = bindingSource1;
                    
                }
            }
        }

Open in new window


I am not getting why there is this error
0
Comment
Question by:r3nder
[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
1 Comment
 
LVL 6

Accepted Solution

by:
r3nder earned 0 total points
ID: 38861988
figured it out
radlabel3.Bindings.Clear();
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

636 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