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. Advertisements

  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. Advertisements

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,609
    Peter Blum
    Mar 5, 2004
  2. msnews.microsoft.com
    Replies:
    1
    Views:
    569
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Sep 26, 2004
  3. Dylan
    Replies:
    5
    Views:
    585
    Daniel T.
    Mar 22, 2005
  4. Pradeep
    Replies:
    2
    Views:
    809
    Patricia Shanahan
    Jan 24, 2007
  5. Øyvind Isaksen
    Replies:
    1
    Views:
    1,253
    Øyvind Isaksen
    May 18, 2007
  6. shapper
    Replies:
    1
    Views:
    340
  7. Chad Scharf
    Replies:
    3
    Views:
    1,100
    Chad Scharf
    Oct 18, 2007
  8. Sundararajan

    Custom Controls- Controls Collection-FindControl method

    Sundararajan, Mar 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    342
    Sundararajan
    Mar 10, 2005
Loading...