Results 1 to 2 of 2

Thread: Controling text box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Ca
    Posts
    106

    Question

    In my program I have around 20 text boxes with different names. I want a simple statements where I can enable and disable all of them. The program requires me not to use linked text boxes.

    text boxes are named txtName, txtAddress, txtPhone....

    the code by Mr.Gates works great. Thanks again for the help and if anyone wants to use this code just paste it from here and add an end if statement after the if statement.

    [Edited by xstopx81 on 08-01-2000 at 02:59 PM]

  2. #2
    Guest
    Code:
    Public Sub DisableTBs(frmName As Form)
    Dim MyControl As Control
    For Each MyControl In frmName.Controls
    If TypeOf MyControl Is TextBox Then MyControl.Enabled = False
    Next
    End Sub
    
    Public Sub EnableTBs(frmName As Form)
    Dim MyControl As Control
    For Each MyControl In frmName.Controls
    If TypeOf MyControl Is TextBox Then MyControl.Enabled = True
    Next
    End Sub

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