Avatar of awilderbeast
awilderbeastFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

c# (winform) binding the same data to two fields?

hi all,

i have a function (below) and use of function below
i have two panels that show or hide depending on what data needs to be displayed

on both panels I need to bind address1 to two fields

i then get an error when debugging
System.ArgumentException: This causes two bindings in the collection to bind to the same property.

so im guessing i cant databind the same field to two different fields?
if not then how would you guys suggest i go about making this work?

Thanks for your help

databind(txtAddress1, "Text", dataSetClients.Clients, "Address1");
databind(txtWPAddress1, "Text", dataSetClients.Clients, "Address1");

// function to add a databind
private void databind(Control ctrlfieldName, string strType, object objTable, string strField)
{
    ctrlfieldName.DataBindings.Add(strType, objTable, strField, true, DataSourceUpdateMode.OnPropertyChanged);
}

Open in new window

.NET ProgrammingC#

Avatar of undefined
Last Comment
awilderbeast
ASKER CERTIFIED SOLUTION
Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of awilderbeast
awilderbeast
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

thanks!
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo