PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Easier way?(Resolved)-VBForums
Results 1 to 9 of 9

Thread: Easier way?(Resolved)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Posts
    83

    Resolved Easier way?(Resolved)

    Is there an easier way to do this?

    VB Code:
    1. Private Sub Form_Load()
    2. Check0.Visible = False
    3. Check2.Visible = False
    4. Check3.Visible = False
    5. Check4.Visible = False
    6. Check5.Visible = False
    7. Check6.Visible = False
    8. Check7.Visible = False
    9. Check8.Visible = False
    10. Check9.Visible = False
    11. Check10.Visible = False
    12. Check11.Visible = False
    13. Check12.Visible = False
    14. Check13.Visible = False
    15. Check14.Visible = False
    16. Check15.Visible = False
    17. Check16.Visible = False
    18. Check17.Visible = False
    19. Check18.Visible = False
    20. Check19.Visible = False
    21. Check20.Visible = False
    22. Check21.Visible = False
    23. Check22.Visible = False
    24. Check23.Visible = False
    25. Check24.Visible = False
    26. Check25.Visible = False
    27. Check26.Visible = False
    28.  
    29. End Sub

    Thanks, Dub
    Last edited by dubbemiah; Nov 25th, 2004 at 09:38 AM.
    ---------------------------------
    Dubbemiah
    "Simply, a beginner."

  2. #2
    Addicted Member
    Join Date
    Mar 2004
    Posts
    146
    It would've been easier for you to make an array of checkboxes. Put a single checkbox on the form, copy it, and select the array option VB gives you when you try to paste. Then just paste as much as you want...and this would be your code:

    VB Code:
    1. Dim i As Integer
    2. For i = 0 to Check.Count - 1
    3. Check.Visible = True
    4. Next

  3. #3

  4. #4
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,287
    Here's another method
    Code:
    For i = 1 To 26
        Me("Check" & i).Visible = False
    Next i

  5. #5

  6. #6
    Lively Member vbgamer45's Avatar
    Join Date
    Sep 2004
    Posts
    67
    Pretty cool learn something everyday.
    Never knew you can do Me("NameofControl")
    That could come have come pretty handy for me in the past.
    Semi VB Decompiler 0.07 Getting better everyday
    http://www.visualbasiczone.com/produ...ivbdecompiler/
    VisualBasicZone
    http://www.visualbasiczone.com
    EasyPHPBB.com
    Free PHPBB forums the quick and easy way!

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2003
    Posts
    83
    It's just not working for me. It always says "Control not found" My textbox arrays are as follows:

    Text(0), Text(1), Text(2), Text(3), etc ending at Text(26)

    code:
    VB Code:
    1. Private Sub Form_Load()
    2.     For i = 0 To 26
    3.         Me("Text" & i).Visible = False
    4.     Next i

    Have also tried this
    VB Code:
    1. Private Sub Form_Load()
    2.     For i = 0 To 26
    3.         Me("Text(" & i & ")").Visible = False
    4.     Next i

    Stuck.. again
    ---------------------------------
    Dubbemiah
    "Simply, a beginner."

  8. #8
    Fanatic Member Blade's Avatar
    Join Date
    Jan 1999
    Location
    Stoke-on-Trent, UK
    Posts
    527
    If your text boxes are in an array then you simply need:

    VB Code:
    1. For i = 0 To 26
    2.         Text(i).Visible = False
    3.     Next i

  9. #9
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Originally posted by dubbemiah
    It's just not working for me. It always says "Control not found" My textbox arrays are as follows:

    Text(0), Text(1), Text(2), Text(3), etc ending at Text(26)

    code:
    VB Code:
    1. Private Sub Form_Load()
    2.     For i = 0 To 26
    3.         Me("Text" & i).Visible = False
    4.     Next i

    Have also tried this
    VB Code:
    1. Private Sub Form_Load()
    2.     For i = 0 To 26
    3.         Me("Text(" & i & ")").Visible = False
    4.     Next i

    Stuck.. again
    The Code Me("Text" & i).Visible = false is for when you have textboxes called:
    Text1
    Text2
    etc
    It won't work with control arrays

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width