You must Sign In to post a response.
  • Category: Windows

    Get all controls using form

    How to get all controls in functions by passing input as Form alone( form name or class namel


    Function void (Form f)
    {
    F.controls // textbox or label
    }
  • #770095
    Hi Lily,

    You can get all controls using for each loop like below.

    public function void (Form f)
    {
    for each(Control c in f.Controls)
    {
    MessageBox.Show(c.Name);
    }
    }

    Hope it will help you.

    Thanks.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "If you can dream it, you can do it."


  • Sign In to post your comments