Clearing contents of textbox which has the focus -(VBA EXCEL)


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Clearing contents of textbox which has the focus -(VBA EXCEL)

  1. #1
    Allison Guest

    Clearing contents of textbox which has the focus -(VBA EXCEL)


    Could anyone tell me how I would determine which text box currently has the
    focus, so that I can clear its contents when a commmand button is clicked?

    Thanks a bunch,
    Allison

  2. #2
    Craig Brown Guest

    Re: Clearing contents of textbox which has the focus -(VBA EXCEL)


    Allison,

    As soon as you click the button, the textbox will have lost the focus.

    I would create a string variable. Each time any textbox loses focus, set
    the string variable to the name of the textbox losing focus. In other words,
    you will need to code every textbox's lostfocus event... When you click
    the button, clear the contents of the textbox saved in the string variable.

    Craig Brown

    "Allison" <amilborrow@expressvu.com> wrote:
    >
    >Could anyone tell me how I would determine which text box currently has

    the
    >focus, so that I can clear its contents when a commmand button is clicked?
    >
    >Thanks a bunch,
    >Allison



  3. #3
    Allison Guest

    Re: Clearing contents of textbox which has the focus -(VBA EXCEL)


    Thank you for your help I just realized the error in my logic as well! Thank
    you for pointing that out to me.


    "Craig Brown" <cbrown.consulting@snet.net> wrote:
    >
    >Allison,
    >
    >As soon as you click the button, the textbox will have lost the focus.


    >
    >I would create a string variable. Each time any textbox loses focus, set
    >the string variable to the name of the textbox losing focus. In other words,
    >you will need to code every textbox's lostfocus event... When you click
    >the button, clear the contents of the textbox saved in the string variable.
    >
    >Craig Brown
    >
    >"Allison" <amilborrow@expressvu.com> wrote:
    >>
    >>Could anyone tell me how I would determine which text box currently has

    >the
    >>focus, so that I can clear its contents when a commmand button is clicked?
    >>
    >>Thanks a bunch,
    >>Allison

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center