Results 1 to 5 of 5

Thread: Textbox Control

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Posts
    445

    Textbox Control

    Hi On a form I have 22 textbox's all of them have the enabled property set to false can I
    change 12 textbox's enabled to true in a similar way as my example The textbox's are in a Array txtSum()
    Code:
     VB6
    
    Dim Ctl As Control
    
         For Each Ctl In frmBalPosts.Controls
            If TypeOf Ctl Is TextBox Then
               Ctl.Text = vbNullString
               Ctl.Enabled = False
            End If
         Next
    Thank you

  2. #2
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,064

    Re: Textbox Control

    Change "Ctl.Enabled = False" to "Ctl.Enabled = True"

    But if they are in an array you can do it another way:

    Code:
        Dim c As Long
        
        For c = txtSum.LBound To txtSum.UBound
            txtSum(c).Enabled = True
        Next

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Posts
    445

    Re: Textbox Control

    Quote Originally Posted by Eduardo- View Post
    Change "Ctl.Enabled = False" to "Ctl.Enabled = True"

    But if they are in an array you can do it another way:

    Code:
        Dim c As Long
        
        For c = txtSum.LBound To txtSum.UBound
            txtSum(c).Enabled = True
        Next
    Hi Eduardo Thank you for your help I will try that later
    RocketRon

  4. #4
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: Textbox Control

    Yes....please get used to using arrays of controls ....it will benefit you greatly in the future
    Sam I am (as well as Confused at times).

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Posts
    445

    Re: Textbox Control

    Quote Originally Posted by SamOscarBrown View Post
    Yes....please get used to using arrays of controls ....it will benefit you greatly in the future
    Hi SamOscarBrown
    Thanks for the help all working as I wanted

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