Setting focus to a control


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
ok . Changed from the Leave Event to the Validated Event , and the messageBox just fires the once.Unless someone jumps in with a reson 'NOT' to use the Validated event, I'll use this in future.
Edited 14 Years Ago by Dustin Taylor
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I have a TextBox on a form , and on the Leave event I have code to call the BrowseLookup and am getting some unexpected behaviour. With some experimenting, i notice that this seems to be standard .net behaviour and happens even if a messagebox.show  is called from the Leave event.

e.g.

If I have on the Leave event of a textBox:   Messagebox.Show("This is a test") , this messagebox displays once.

if I have : MessageBox.Show("This is a test");   followed by This.MyOtherControl.Focus(), the Messagebox fires twice. The fact that I have a Focus seems to be firing the 'Leave' event a second time.

I would need to do this type of thing quite regulalry  i.e. on leaving a control, DO SOMETHING and then set focus to another control. Is the 'Leave' event the best time to do this or is there some other way round the Leave event firing twice ?

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search