locked
how to find controls inside the panel? (winforms compact framework) RRS feed

  • Question

  • Hi

    There is a panel, which contains number of UserControls, each UserControl contains one Combobox, 2 lables.

    How to itterate through all usercontrols and get control properties?? please


    Regards
    Abinash

    Tuesday, July 28, 2009 6:58 AM

Answers

  • Hi,

    I have put together a test application that should help you (User Control Iterator Tester (CF2.0 VS2008)) :-

    Basically, you can iterate through the Controls of the Form finding your UserControl and then Iterate through the Controls collection of your UserControl.

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

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Tuesday, July 28, 2009 7:28 AM
  • Hi Abinash,

    First you need to make combobox as public inside the user controls. So that you can access them.


    Try some thing like this:

    UserControl1 []UC = new UserControl();

    for(i=0;i<=10;i++)
    UC[i].Combobox1.SelectedItem.tostring()


    Regards,
    Malleswar


    Tuesday, July 28, 2009 7:10 AM

All replies

  • Hi Abinash,

    First you need to make combobox as public inside the user controls. So that you can access them.


    Try some thing like this:

    UserControl1 []UC = new UserControl();

    for(i=0;i<=10;i++)
    UC[i].Combobox1.SelectedItem.tostring()


    Regards,
    Malleswar


    Tuesday, July 28, 2009 7:10 AM
  • Hi,

    I have put together a test application that should help you (User Control Iterator Tester (CF2.0 VS2008)) :-

    Basically, you can iterate through the Controls of the Form finding your UserControl and then Iterate through the Controls collection of your UserControl.

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

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Tuesday, July 28, 2009 7:28 AM