+ Reply to Thread
Results 1 to 2 of 2

Control arrays and initialize does not work!

  1. #1
    Registered User
    Join Date
    04-13-2010
    Location
    can
    MS-Off Ver
    Excel 2003
    Posts
    1

    Control arrays and initialize does not work!

    When I have this code in UserForm_Initialize

    Dim i As Integer
    'clear textboxes
    For i = 1 To 30
    Set TextBoxArray(i) = Controls("TextBox0" & i)
    TextBoxArray(i).Text = ""
    TextBoxArray(i).Value = ""
    Next i


    It does not clear the textboxes.



    but when I add a messagebox, it clears them.

    Dim i As Integer
    'clear textboxes
    For i = 1 To 30
    MsgBox(i)
    Set TextBoxArray(i) = Controls("TextBox0" & i)
    TextBoxArray(i).Text = ""
    TextBoxArray(i).Value = ""
    Next i


    Excel 2003 and Windows XP

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Control arrays and initialize does not work!

    Hi tesamy and welcome to the forum
    However
    Your post doesn't comply with the rule # 3
    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1