none
Update TextBox.Text on BindingSource.CurrentChanged RRS feed

  • Question

  • Hi,

    I have an arraylist filled with objects from a big class which is mainly formed by strings. I have attached a BindingSource to this Arraylist. 
    Let´s call it _bSource.

    The fact is that I need to fill the text from some textboxes with the data from the classes contained in the ArrayList via the BindingSource.
    In order to associate a DataSource to the textboxes I use:

    textbox1.DataBindings.Clear();
    textbox1.DataBindings.Add("Text", _bSource, "Data1");

    However, as long as BindingNavigator doens´t exist in CF. NET 2.0 (the platform I am currently using), does anybody know which alternative I have in order to update the text from these textboxes??

    I have tried with the lines above AFTER moving _bSource with _bSource.Position++ (e.g.) and it works, but I would like a more professional solution.

    Thanks in advance
    Thursday, February 25, 2010 5:34 PM

Answers

All replies

  • Hi,

    I don't know whether this will help however I have a sample that uses DataBinding with some additional property settings which you may require :-

    http://www.smartmobiledevice.co.uk/Projects/BindingButtonTextTester.zip

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Thursday, February 25, 2010 7:08 PM
  • Thank you very much Paul.

    What I seem at first glance is that I would need one Binding object attached to each Property/Textbox if I chose to follow your example.

    The classes I am using contains almost 40 public properties, so maybe the best option should be to give to the form the complete ArrayList and whenever the user clicked on a button in order to consult another class, get another object from the ArrayList and fill every textbox manually.
    With this option I save most of the 40 Binding Objects and the problems with the Binding Source....

    Is there another way?

    Thanks again.

    Friday, February 26, 2010 8:06 AM