Results 1 to 6 of 6

Thread: Disable txtboxes without greying...

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    2

    Question Disable txtboxes without greying...

    I need to lock an textbox. I've tried to use .enabled=false but it dimmed textbox. How can i achieve it?

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    umm it;s not a good idea to disable it
    set the ReadOnly property to True, and if you want the back color to be white then change the BackColor property to white
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2002
    Posts
    2
    Yes, but there's two problems. First, control can still be focused. Second, forecolor cannot be normalized.

  4. #4
    Member wej42's Avatar
    Join Date
    May 2002
    Location
    Rhode Island, USA
    Posts
    48
    private sub textbox_Change(byval blah blah blah............)

    if text1.text <> "whatever you want it to say" then
    text1.text = "whatever you want it to say"
    end if

    end sub

    try that... under the change (or somethin like that) thing
    Visual Basic 6.0, Visual Basic .NET, C#, C++, ASM, HTML

  5. #5
    Member wej42's Avatar
    Join Date
    May 2002
    Location
    Rhode Island, USA
    Posts
    48

    FIXED

    Private Sub text1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles text1.TextChanged
    If text1.Text <> "Whatever" Then
    text1.Text = "Whatever"
    End If
    End Sub

    try that, that way they can still highlight it and copy/cut or whatever but if its ever changed, then it reverts back like .00000000000000000000001 miliseconds later

    hope this helps
    Visual Basic 6.0, Visual Basic .NET, C#, C++, ASM, HTML

  6. #6
    Member
    Join Date
    Nov 2001
    Location
    UK
    Posts
    46

    Lightbulb Works in VB should be ok for .net

    Hi

    In VB the desire results could be obtained by placing the text box
    in a frame. setting the frame border to none, so that it can not be seen. if you now set the frame enabled property to false, none of the controls in the frame are now accessable,

    textbox is completely disabled from user selection or input, but looks the same

    i use this all the time for enabling and disabling groups of controls

    Si



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