Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / December 2005

Tip: Looking for answers? Try searching our database.

detecting when focus leaves a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dean Slindee - 21 Dec 2005 18:52 GMT
In my application there is a main form with a tabcontrol.  On each page in
the tabcontrol is a panel upon which is painted a "sub" form.  The main form
acts as the "application host", while the subforms are where data values
contained in underlying tables are displayed, inserted, updated or deleted.

I don't make the user press an "Edit" button to enable the textboxes on the
subforms.  Rather, the subforms and their textboxes are always in edit mode.
However, the user must remember to press the Update, Insert or Delete button
to make any changes keyed into the subform affect the underlying database.

Simple enough, but not completely foolproof given inept or careless users.
Therefore, I would like to implement a reminder process using a dialog box.
So that, when the user makes a change to any "data-enabled" control
(textbox, checkbox, combobox, etc), a form-level boolean variable becomes
"dirty".  This code I have written and tested ok.

My problem is in detecting when the user has decided to move off the "dirty"
form.  I thought that I could detect this action in code placed in the
form_LostFocus event.  Problem is, the code is in the LostFocus event, but
the event is not being fired.  Is this normal?  Is there another way to
detect moving off a form?

Thanks in advance,

Dean Slindee
Chris - 21 Dec 2005 20:18 GMT
> In my application there is a main form with a tabcontrol.  On each page in
> the tabcontrol is a panel upon which is painted a "sub" form.  The main form
[quoted text clipped - 21 lines]
>
> Dean Slindee

Do you actually have a form residing inside a panel on a tab control?
Have you tried using the Panel.LostFocus event?  If it is actually a
form, look at using the Deactivate event.

How do you "paint a "sub" form"?

Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.