BIND DATATABLE TO TEXTBOX USERCONTROL

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C# 
C#
 1418  View(s)
Ratings:
Rate this:

I searched a lot for this problem but i did not find any clear post about that.

I do databinding with this command:

userControl11.DataBindings.Clear();

userControl1.DataBindings.Add( "Text",dt,"DM" );

I also put dt for datagridview datasource.

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.

I think this problem is simple.Should I use INotifyPropertyChanged?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: Bind DataTable To Textbox UserControl

    Hi Ankit,


    simply I did this in Usercontrol :

      public override string Text

        {

            get { return txtmoney.Text; }

            set

            {

                txtmoney.Text = value;

            }

        }

    And this to bind in my form :

    uctextbox1.DataBindings.Add( "text",DT,"DM" );

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!