Results 1 to 4 of 4

Thread: control arrays

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283

    control arrays

    how do i refer to objects like text boxes as if they were in an array. basically i want to be able to say
    (TextBox + i).Text = "..."
    basically, how can i refer to a textbox where i have a variable of type string as the name of the textbox?

    thanks

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If you mean like control arrays as in VB6 , then this's already died out .

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    here's one way ...
    VB Code:
    1. [color=blue]Dim[/color] tb [color=blue]As[/color] Control
    2.         [color=blue]For Each[/color] tb [color=blue]In MyBase[/color].Controls
    3.             [color=blue]If[/color] tb.Name = "TextBox1" [color=blue]Then[/color]
    4.                 tb.Text = "some text"
    5.             [color=blue]End If[/color]
    6.         [color=blue]Next[/color]
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by dynamic_sysop
    here's one way ...
    VB Code:
    1. [color=blue]Dim[/color] tb [color=blue]As[/color] Control
    2.         [color=blue]For Each[/color] tb [color=blue]In MyBase[/color].Controls
    3.             [color=blue]If[/color] tb.Name = "TextBox1" [color=blue]Then[/color]
    4.                 tb.Text = "some text"
    5.             [color=blue]End If[/color]
    6.         [color=blue]Next[/color]
    If he really means controls array , then it isn't this one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width