Results 1 to 12 of 12

Thread: disabling textbox in the form

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    india
    Posts
    42

    Question disabling textbox in the form

    if we disable any text box in the form it display grey text in it. is it possible to display text dark black even it is enable = false???

    how it is possible to do this???

    thanx in advance

    firoz

  2. #2
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Try putting the text box in a frame and diabling the frame.

  3. #3
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    try changing the backgroung colour of the text box once disabled!!

    not sure if it will work but have a go!!

    another way could be doing it from the windows settings in Control pannel!
    Sanj

  4. #4
    Junior Member
    Join Date
    Mar 2001
    Location
    Accra, Ghana
    Posts
    26
    you could use the locked property of the textbox control which disables the textbox from being edited but does not greyout the text.

    eg. txtName.Locked = true.

    this can be done in Code or in the properties of the TextBox control.

  5. #5

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    india
    Posts
    42
    thanku for ur replay.

    we can do the same by putting readonly property of the text box true. but by this trick tab stop of the text box will be there.

    the background of the textbox remain the same(white) but the text color ofthe textbox change to the grey.

    please try if it is possible by subclassing the text box???

    thanx once again!!


    firoz

  6. #6
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    I tested it and this works for me. Add a frame to the form, put the textbox in the frame and a command button, then add this code. Click the command button to enable/disable the textbox.

    Code:
    Private Sub Command1_Click()
     Me.Frame1.Enabled = Not (Me.Frame1.Enabled)
    End Sub
    
    Private Sub Form_Load()
     Me.Frame1.BorderStyle = 0
    End Sub

  7. #7

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    india
    Posts
    42
    thanku all gays for ur help. thanku very much all of u.

    using frame for all textbox may require lot of programming in the form. speacially when u have lot of text boxes in the form.

  8. #8
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    firoz,

    using frame for all textbox may require lot of programming in the form. speacially when u have lot of text boxes in the form.
    Not really, you are just disabling the frame instead of the actual textbox, so it should take exactly the same code. At design time set the border style of the frame to none. At run time you just need 1 line:

    Me.Frame1.Enabled = true/false

    Also it sounds like you are using a text box to display read only data, in which case I would use a label instead of a textbox .

  9. #9
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Originally posted by firoz
    thanku all gays for ur help. thanku very much all of u.
    ROLLING ON FLOOR LAUGHING MY ASS OFF!!!!!!

    ok, n/m

  10. #10
    Addicted Member Sanj's Avatar
    Join Date
    Apr 2001
    Location
    in front of my PC
    Posts
    242
    he he

    now thats go to be tghe quote of the day!!

    Sanj

  11. #11

    Thread Starter
    Member
    Join Date
    May 2001
    Location
    india
    Posts
    42

    Ops!!

    typing mistack!!!!

    thanku very much Nucleus for ur help. u got the right think. i want to display matters in the text box only. if user click on edit button then the all related textbox should able to accept the input.


    thanku once again. it working adjact i want.

  12. #12
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    I missed it first time around , classic.

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