Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jul 2002
    Location
    Wellington, New Zealand
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using dynamic control names (word2k/win2k)

    I have a multipage control with page named pg1,pg2 pg3 etc
    on the pages are text boxes named txt1_pg1,txt2_pg1,txt1_pg2 etc
    When the user double clicks on a list box I want to update the .text property of a specific textbox where the last digit eg the 1 in txt1_pg"1" is equal to the .listindex from the list box.

    The only way I have found to do this is to cycle through all the controls and compare the .name property, this seems tremendously inefficient. Is there a better way to do this.

    The attached file has a hack to illustrate what I am trying to do ish

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Using dynamic control names (word2k/win2k)

    Take a look at the code inside the loop in <post#=250758>post 250758</post#>. Apparently, since the control .Name is just a string, you can use an expression to "construct" the Index into the Controls collection. Does that work for you?

  3. #3
    Lounger
    Join Date
    Jul 2002
    Location
    Wellington, New Zealand
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using dynamic control names (word2k/win2k)

    Another one bites the dust
    You guys rock

    Cheers

Posting Permissions

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