473,847 Members | 1,815 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 2220
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
73234
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
1933
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
1657
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
2216
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
3599
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
5138
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
2375
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
2101
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
1275
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
9881
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10982
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10706
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
10331
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
9480
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...
0
7053
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
5718
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4116
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3160
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.