Controls Collection

Discussion in 'ASP .Net' started by et, Feb 19, 2005.

  1. et

    et Guest

    you used to be able to do:
    dim ctrl as Controls
    for each ctrl in myform
    'do this
    next

    Now I cannot do that. How can I do something for every control on a form or
    a page.
    et, Feb 19, 2005
    #1
    1. Advertising

  2. et

    IPGrunt Guest

    On 19 Feb 2005, "et" <> postulated in
    news::

    > Subject: Controls Collection
    > From: "et" <>
    > Newsgroups: microsoft.public.dotnet.framework.aspnet
    >
    > you used to be able to do:
    > dim ctrl as Controls
    > for each ctrl in myform
    > 'do this
    > next
    >
    > Now I cannot do that. How can I do something for every control on

    a form or
    > a page.
    >
    >
    >


    Considering you haven't initialized myForm, no you cant.

    Have you tried iterating over:

    For Each ctrl in yourPage.Controls

    In C# the current page is called this, as in this.Controls

    Can't help you right now in VB. (Bad memory!)

    -- ipgrunt
    IPGrunt, Feb 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeremy Ames

    Adding controls to Page.Controls collection

    Jeremy Ames, Mar 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    1,425
    Peter Blum
    Mar 5, 2004
  2. msnews.microsoft.com
    Replies:
    1
    Views:
    455
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Sep 26, 2004
  3. Øyvind Isaksen
    Replies:
    1
    Views:
    946
    Øyvind Isaksen
    May 18, 2007
  4. shapper
    Replies:
    1
    Views:
    279
  5. Chad Scharf
    Replies:
    3
    Views:
    852
    Chad Scharf
    Oct 18, 2007
Loading...

Share This Page