Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default event which occurs when a TextBox receives focus

When my text box receives focus, what event occurs?
I need this to be able to undo user's changes.

Dim OldValue as String
'when TextBox receives focus
OldValue = TextBox1.Text
'when user decides to discard changes
TextBox1.Text = OldValue

Thanks in advance,
Mike510


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default event which occurs when a TextBox receives focus

Where it the textbox. What type of control is it (Control toolbox Toolbar
or Drawing Toolbar)?

If on a worksheet and ActiveX/Control Toolbox Toolbar, then use the GotFocus
event.

--
Regards,
Tom Ogilvy



"Mikhail" wrote in message
...
When my text box receives focus, what event occurs?
I need this to be able to undo user's changes.

Dim OldValue as String
'when TextBox receives focus
OldValue = TextBox1.Text
'when user decides to discard changes
TextBox1.Text = OldValue

Thanks in advance,
Mike510




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default event which occurs when a TextBox receives focus

Hi,

you could use the events of individual controls to achieve
this, but don't you find it a little unnatural? It seems
you are displaying a form to let the user edit something,
and the user should be able to choose to cancel. If I were
you I'd encapsulate the work into a single function
instead of bothering with individual control's events.

Using custom types this becomes very clean and simple. As
an example, let's assume we are editing a person in a
simple address book. Then the following should give you an
idea.

Type TPersonSettings

-----Original Message-----
When my text box receives focus, what event occurs?
I need this to be able to undo user's changes.

Dim OldValue as String
'when TextBox receives focus
OldValue = TextBox1.Text
'when user decides to discard changes
TextBox1.Text = OldValue

Thanks in advance,
Mike510


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox added to Form at runtime too small, can't control size andchange event won't trigger RCGUA Excel Worksheet Functions 2 December 10th 08 09:34 PM
Textbox added to Form at runtime too small, can't control size andchange event won't trigger RCGUA Excel Worksheet Functions 0 December 10th 08 07:48 PM
Action Event, CheckBox, Add Row and Textbox Ryan Excel Discussion (Misc queries) 2 July 17th 07 02:32 PM
How can I expose the TextBox BeforeUpdate event to my user class? bereid Excel Discussion (Misc queries) 0 November 30th 05 05:00 PM
Which textbox have focus? Tom Ogilvy Excel Programming 0 August 27th 03 03:12 PM


All times are GMT +1. The time now is 06:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"