473,651 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,leav e,lostfocus,for mclosing,valida ting to prevent user
leave before save. but no one work:

the [deactivate,leav e,lostfocus,for mclosing] 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 2209
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,leav e,lostfocus,for mclosing,valida ting to prevent user
leave before save. but no one work:

the [deactivate,leav e,lostfocus,for mclosing] 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 SelectedIndexCh anged 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
73205
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
1926
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. By this action, automatically, the leave event executes its scripts and this is my problem. How can I remove or disable the Leave Event Script when I m in the textchanged. I suppose it's when the tabpage is added.
3
1650
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 from 1 when form 2 closes. How would I trap that event? All ideas welcome
2
2206
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 easier to have each one seperate. My idea was to just add and remove each form as necessary based on what page the user clicked on, but I am getting an error when I try to add the form as a tabpage: Dim frm as new Form1
8
3572
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 picture box, lots of text boxes (for input).. you get the idea. All of a sudden everything on the form has disappeared, it looks like a blank, newly created form. I can still get to the properties of every item on the form using the drop-down box in...
6
5113
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. Can anyone tell me how I can do this? Thanks for any help Bob
12
2359
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 from the User Control in Form2 ? Hope this is clear enough...
1
2088
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 which when clicked closes that specific tabpage. any suggestions on how to implement this are most welcome!
0
1268
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 application for to remove the TabPages. This is not an ideal situation.
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8571
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.