473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trap leave and closing Form that place in TabPage

I have TabControls that Hold Forms on his TabPges (this make me easy
to give ability to Designing each form in his IDE window).
When form x is in middle of Edit Data Mode, I going to prevent:
Closing App or switch to other tabs until save done explicit by user.
So I try use events like:
deactivate,leave,lostfocus,formclosing,validating to prevent user
leave before save. but no one work:

the [deactivate,leave,lostfocus,formclosing] not fire at all when app
closing or switch to other tabs
the Validating fire, but when (there no change if i set e.cancel =
true or e.cancel = false) user switch to othet tab we got unexpected
behavior: the validating fire 3 times and switch to next tab, now the
validating fire again and again as respond to any click on App window!

this is bug?

Oct 9 '07 #1
3 2194
On Oct 9, 2:43 am, mtczx...@yahoo.com wrote:
I have TabControls that Hold Forms on his TabPges (this make me easy
to give ability to Designing each form in his IDE window).
When form x is in middle of Edit Data Mode, I going to prevent:
Closing App or switch to other tabs until save done explicit by user.
So I try use events like:
deactivate,leave,lostfocus,formclosing,validating to prevent user
leave before save. but no one work:

the [deactivate,leave,lostfocus,formclosing] not fire at all when app
closing or switch to other tabs
the Validating fire, but when (there no change if i set e.cancel =
true or e.cancel = false) user switch to othet tab we got unexpected
behavior: the validating fire 3 times and switch to next tab, now the
validating fire again and again as respond to any click on App window!

this is bug?
I'm sorry if I misunderstand you, your english is barely
comprehendable.
>From what I read you are trying to trap two actions. First, you want
to know when the form closes, and secondly you want to know when the
selected tab changes right?

To trap when the form is closing, you must subscribe to the
FormClosing event of the parent form.

To trap when a different tab is selected, you can subscribe to the
TabControl's SelectedIndexChanged event.

Thanks,

Seth Rowe

Oct 9 '07 #2
>
to know when the form closes, and secondly you want to know when the
selected tab changes right?
That exactly I claim. the FormClosing event in the inner form (place
on TabPage), is not fired while main form closing!?
To trap when the form is closing, you must subscribe to the
FormClosing event of the parent form.
According the engineering approach, we preferring to build modular
code. the form that contain the ControlTab is not know the Inner form.
so the right place to prevent leave the inner Form without saving is
the Inner form itself. but no way to trap it.

Oct 10 '07 #3
On Oct 10, 3:34 am, mtczx...@yahoo.com wrote:
to know when the form closes, and secondly you want to know when the
selected tab changes right?

That exactly I claim. the FormClosing event in the inner form (place
on TabPage), is not fired while main form closing!?
To trap when the form is closing, you must subscribe to the
FormClosing event of the parent form.

According the engineering approach, we preferring to build modular
code. the form that contain the ControlTab is not know the Inner form.
so the right place to prevent leave the inner Form without saving is
the Inner form itself. but no way to trap it.
Could you give me some sample code that creates the form, the "inner
form", and the tabcontrol? I'm still not quite understanding what you
are saying, and some sample code would give me something to work with.

Thanks,

Seth Rowe

Oct 10 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
1
by: Stan Sainte-Rose | last post by:
Hi, I have a problem with my textchanged and leave events I have a script in the leave event of my textbox and also in my textchanged. The script in my textchanged adds and displays a tabpage....
3
by: Gavin | last post by:
Hi All I have a project that has 2 forms, the main form displays various sql data items and the second form is for editing / updating 1 particular table. I would like to refresh a dataset on...
2
by: GatorBait | last post by:
Hi everyone, I have a tabcontrol on a form that contains 4 tabs. I want to make each tab a seperate form because there is a great deal of code behind each page, and organizationally it was...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
6
by: Robert Dufour | last post by:
On my form if the user clicks the upper right hand corner to close the form I want to trap that event and do a check to see if closing is allowed, if not, I want to stop the form closing action. ...
12
by: Rob | last post by:
Let's say you open Form1 that contains TabControl1 There are several tabs on TabControl1 Now you open a new Form2 that contains a User Control How can you determine the Selected tab in Form1...
1
by: Jeff | last post by:
..NET 2.0 I've created a form which contain a TabControl. During runtime TabPages will be added in the TabControl. I would like to have a feature like an "X" (like closing windows) in the tab...
0
by: Jeff | last post by:
Hey ..NET 2.0 I have a form containing a TabControl. During runtime TabPages get added to this TabControl. I want a way to close the TabPages. As it is now, I have to restart the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.