+ Reply to Thread
Results 1 to 5 of 5

Locked textbox clears text when command button clicked.

  1. #1
    Registered User
    Join Date
    10-23-2012
    Location
    china
    MS-Off Ver
    Excel 2010
    Posts
    12

    Locked textbox clears text when command button clicked.

    Hi all,

    I have a userform with a textbox, combobox and a command button. The textbox is already locked in the properties.

    Item 1 of the combobox will do .find operation and displays the result in the textbox upon clicking the button.
    Item 2 of the combobox will do autofilter operation, store the filtered data in an arrary and display the array data in the textbox when the button clicked.

    Both operations display result in the textbox just fine. I wanted the text in the textbox to be locked so that no changes can be made on the display result.
    The problem is, text result of the autofilter disappears when mouse click in textbox. But this doesnt happen for the .find operation.


    What may the cause of this problem? Could anyone help me with this?

    Thanks in advance.

  2. #2
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Locked textbox clears text when command button clicked.

    Use
    Please Login or Register  to view this content.
    It will prevent the user entering it.
    Also make sure you do not have any Textbox1 enter scripts that may be clearing it.

  3. #3
    Registered User
    Join Date
    10-23-2012
    Location
    china
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Locked textbox clears text when command button clicked.

    i tried to use

    Please Login or Register  to view this content.
    i dont want to disable the textbox as it will make the text turn grey colour. Or is there a way to change the text colour of the disable textbox into black?

  4. #4
    Registered User
    Join Date
    10-23-2012
    Location
    china
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Locked textbox clears text when command button clicked.

    Here is my code for the autofilter operation.. Everything works fine, until the user click in the textbox and the text disappears. I wanted the text in the textbox to be locked so that it will not disappears when user clicks the textbox.

    Could anyone help me with this? Thanks

    Please Login or Register  to view this content.
    Last edited by cocobean; 11-14-2012 at 02:48 AM.

  5. #5
    Registered User
    Join Date
    10-23-2012
    Location
    china
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Locked textbox clears text when command button clicked.

    Could anyone help me with this?

    I've been trying to solve this problem for few days. All the logic works fine but the text in the textbox disappears on mouse click? I already locked the textbox in the properties? Why did this happened? Is there anything wrong with my logic/codes?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1