Disable textbox and font color

Discussion in 'Questions (Windows Mobile)' started by Dr. Feelgood, Feb 13, 2008.

  1. Dr. Feelgood

    Dr. Feelgood Member

    I want to output to a textbox but I don't want the user to be able to edit it. Disabling it works nicely but I can't seem to control the color, I only can get that disabled grey color no matter what I set as font color. I can change the background color, just not the font. Is there maybe another way to disable the text box?
     
  2. brathbone

    brathbone Member Licensed User

    You could use ignorekey in the KeyPress Event for your textbox:

    Sub TextBox1_KeyPress (key)
    textbox1.IgnoreKey
    End Sub

    Does that achieve the desired effect?

    hth,
     
  3. klaus

    klaus Expert Licensed User

    You have different possibilites:
    1. As already written by brathbone use the IgnoreKey in TextBox_KeyPress

    2. Use the TextBoxEx library, with the ReadOnly property
    http://www.basic4ppc.com/forum/showthread.php?t=1108&highlight=textboxex&page=2

    or this library with similars properties
    http://www.basic4ppc.com/forum/showthread.php?t=1238

    3. Use Label object
    Label1.Text="123"
    You can play with all the colors

    Disadvantages from my point of view:
    1. 2. The select highlighting still remains, which can be confusing for the user
    3. There is no Border Property

    We should remember what the TextBox and Label objects are primary intended for:
    Label Display text, when the user has never to edit any data.
    TextBox Enter text with a certain number of functions.
    The gray text shows the user that at certain steps in the program the editing is disabeled.

    Best regards

    Klaus
    Switzerland
     
    Last edited: Feb 13, 2008
  4. Dr. Feelgood

    Dr. Feelgood Member

    Thank you both, the suggestions worked well. I see what you mean about the highlighting, I suppose if I really wanted to be flashy I could design my own output box image and use the label command in the middle of it to give the desired effect. Thanks again for the help.
     
  5. Cableguy

    Cableguy Expert Licensed User

    Another "small trick" would be to change the focused control upon textbox get focus...But it could also lead to un-wanted behavior...
     
Loading...