Click here to Skip to main content
15,907,395 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I searched a lot for this problem but i did not find any clear post about that.

I do databinding with this command:

C#
userControl11.DataBindings.Clear();
userControl1.DataBindings.Add( "Text",dt,"DM" );


this work for usual controls but not for usercontrols.

Now the Text of the usercontrol does not change if i select different rows of datagridview and it is always empty.

Should I use
C#
INotifyPropertyChanged
for this ?
Posted
Comments
thursunamy 4-Dec-12 10:34am    
Hi,

You can look at this

http://www.codeproject.com/Articles/15396/Implementing-complex-data-binding-in-custom-contro

1 solution

I knew the answer is simple!

simply I did this in Usercontrol :

C#
public override string Text
   {
       get { return txtmoney.Text; }
       set
       {

           txtmoney.Text = value;

       }
   }

And this to bind in my form :

C#
uctextbox1.DataBindings.Add( "text",DT,"DM" );
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900