CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 1999
    Location
    Hong Kong
    Posts
    18

    How to set all textbox enabled = false

    Hi,
    Is there any convenient way to set the enabled property to false for all textbox in my form ?
    Thank you !


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: How to set all textbox enabled = false

    You could use this as a general way of enabling / disabling all the textboxes on a passed form :


    private Sub EnableTextBoxes(frm as Form, byval bEnable as Boolean)
    Dim ctl as Control
    for Each ctl In frm.Controls
    If TypeOf ctl is TextBox then
    ctl.Enabled = bEnable
    End If
    next
    End Sub




    So you could call it with :

    EnableTextBoxes Form1, false
    '
    ' or - from within Form1
    '
    EnableTextBoxes me, false





    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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

Featured