CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2000
    Location
    Israel
    Posts
    33

    I have a fixed size number of controls ( textBox ) and I need to disable some of them

    Thanks, Udi

  2. #2
    Join Date
    Jul 2000
    Posts
    70

    Be more specific

    You need to be more specific.

    textbox1.Enabled = False

    that's the easy way.

    to completely remove it from view:
    TextBox1.Visible = False

    Here is a more complex example that will allow you to go through all the boxes on a given form and allow you to do what ever you need to. For example check the text to see if it should be disabled.

    Dim aControl As Control
    For Each aControl In Me.Controls
    If (aControl.GetType().ToString().Equals("System.Windows.Forms.TextBox")) Then
    'code to text boxes here.
    'use aCountrol to get to properties.
    aControl.Enabled = False
    End If
    Next

    This is not the best method, but it will work. You could also use the typeof() function.

    Good luck

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