473,218 Members | 1,384 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,218 software developers and data experts.

Urgent help needed with MDI Forms

Hi,

The following is from my friend, who has some technical problem at
present in accessing the web... I am writing for him... Kindly
request your inputs ASAP, as he has some kind of deadline tomorrow.

.................................................. ........................................
I am having an issue with MDI form. I have an MDI form and some Child
forms. In order to enable for a choice, I am displaying a message box
in the FormClosing event of both the forms. When the form is closed
individually, the code works fine, closing the form depending on
confirmation from the user, other wise the e.Cancel event is set to
true.
The problem is when I try to close the MDI form when the child
forms are open. By virtue of the property in .NET it goes through the
closing events of all the forms.., finally running the closing event
of the MDI form, which is undesirable. Is it possible to display a
different message box and close all child forms and the MDI form also,
without calling the formclosing method of the child forms?

If not, how do i display a message box confirmation when user clicks
on the X on the form? Please help me.. Its urgent...
.................................................. ..........................................

Thanks & Regards,
-feltra

Apr 11 '07 #1
2 1481
On Apr 11, 12:00 pm, "feltra" <fel...@gmail.comwrote:
Hi,

The following is from my friend, who has some technical problem at
present in accessing the web... I am writing for him... Kindly
request your inputs ASAP, as he has some kind of deadline tomorrow.

.................................................. .......................................
I am having an issue with MDI form. I have an MDI form and some Child
forms. In order to enable for a choice, I am displaying a message box
in the FormClosing event of both the forms. When the form is closed
individually, the code works fine, closing the form depending on
confirmation from the user, other wise the e.Cancel event is set to
true.
The problem is when I try to close the MDI form when the child
forms are open. By virtue of the property in .NET it goes through the
closing events of all the forms.., finally running the closing event
of the MDI form, which is undesirable. Is it possible to display a
different message box and close all child forms and the MDI form also,
without calling the formclosing method of the child forms?

If not, how do i display a message box confirmation when user clicks
on the X on the form? Please help me.. Its urgent...
.................................................. .........................................

Thanks & Regards,
-feltra
Is it possible to display a
different message box and close all child forms and the MDI form also,
without calling the formclosing method of the child forms?
Well, the formclosing method is going to be called on all of them
period. What your friend could do is have a public property that
controls which message is shown (if any) on closing. Then you just
have to set that property before the method is called.
If not, how do i display a message box confirmation when user clicks
on the X on the form?
I'm not in Visual Basic right now, so I can't confirm this, but if you
want to do something immediately after the "X" is clicked and before
any formclosed events fire, you'll probably need to override wndproc
and listen for the appropriate window's message. Then just loop
through any mdi children the form has and set the above mentioned
property that will prevent the messages from showing. Below is an old
post from Herfried Wagner that demonstrates what to do in the wndproc
method. You should be able to adapt it to what you need.

Thanks,

Seth Rowe

Is there a way I can get into a form's close/minimize/maximize events when
those buttons (the 3 small squared button in the upper right corner of a
form) are clicked?
\\\
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Private Const SC_CLOSE As Int32 = &HF060

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SYSCOMMAND Then
Select Case m.WParam.ToInt32()
Case SC_MAXIMIZE
Debug.WriteLine("Form gets maximized.")
Case SC_MINIMIZE
Debug.WriteLine("Form gets minimized.")
Case SC_RESTORE
Debug.WriteLine("Form gets restored.")
Case SC_CLOSE
Debug.WriteLine("Form gets closed.")
End Select
End If
MyBase.WndProc(m)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 11 '07 #2
Thanks a lot for the quick response, Rowe. I have fwded your message
to my friend... Hope it solves the problem for him...

Thanks & Regards,
-feltra
On Apr 11, 9:38 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
On Apr 11, 12:00 pm, "feltra" <fel...@gmail.comwrote:
Hi,
The following is from my friend, who has some technical problem at
present in accessing the web... I am writing for him... Kindly
request your inputs ASAP, as he has some kind of deadline tomorrow.
.................................................. .......................................
I am having an issue with MDI form. I have an MDI form and some Child
forms. In order to enable for a choice, I am displaying a message box
in the FormClosing event of both the forms. When the form is closed
individually, the code works fine, closing the form depending on
confirmation from the user, other wise the e.Cancel event is set to
true.
The problem is when I try to close the MDI form when the child
forms are open. By virtue of the property in .NET it goes through the
closing events of all the forms.., finally running the closing event
of the MDI form, which is undesirable. Is it possible to display a
different message box and close all child forms and the MDI form also,
without calling the formclosing method of the child forms?
If not, how do i display a message box confirmation when user clicks
on the X on the form? Please help me.. Its urgent...
.................................................. .........................................
Thanks & Regards,
-feltra
Is it possible to display a
different message box and close all child forms and the MDI form also,
without calling the formclosing method of the child forms?

Well, the formclosing method is going to be called on all of them
period. What your friend could do is have a public property that
controls which message is shown (if any) on closing. Then you just
have to set that property before the method is called.
If not, how do i display a message box confirmation when user clicks
on the X on the form?

I'm not in Visual Basic right now, so I can't confirm this, but if you
want to do something immediately after the "X" is clicked and before
any formclosed events fire, you'll probably need to override wndproc
and listen for the appropriate window's message. Then just loop
through any mdi children the form has and set the above mentioned
property that will prevent the messages from showing. Below is an old
post from Herfried Wagner that demonstrates what to do in the wndproc
method. You should be able to adapt it to what you need.

Thanks,

Seth Rowe
Is there a way I can get into a form's close/minimize/maximize events when
those buttons (the 3 small squared button in the upper right corner of a
form) are clicked?

\\\
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Private Const SC_CLOSE As Int32 = &HF060

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SYSCOMMAND Then
Select Case m.WParam.ToInt32()
Case SC_MAXIMIZE
Debug.WriteLine("Form gets maximized.")
Case SC_MINIMIZE
Debug.WriteLine("Form gets minimized.")
Case SC_RESTORE
Debug.WriteLine("Form gets restored.")
Case SC_CLOSE
Debug.WriteLine("Form gets closed.")
End Select
End If
MyBase.WndProc(m)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 11 '07 #3

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

Similar topics

3
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is...
3
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the...
4
by: Random | last post by:
The way I've built my page is to take the user through a multi-form process, only rendering those controls that are needed for each section. The ViewState is working the way I want it to,...
17
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be...
4
by: Joe Kasta | last post by:
Here's a tricky question..:) I have a a function in a webform that will draw a checkbox in a given area (note, this is an override of a PaintForeground function, not a drop / drag of a checkbox...
0
by: swaroopa | last post by:
Hello Partner Please forward some good resumes with excellent communication skills. 1.REMEDY AR CONSULTANT Exp: 6-10YEAR Location: San Jose CA Duration : 2 Months
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
5
by: Aykut Canturk | last post by:
Dear friends, I recently decided to move vb.net 2005 from vb6. my projects has average of 200 forms and 20 modules. I mostly write enterprise solution about production automation like...
1
by: teddymeu | last post by:
hi guys I posted the other day regarding a solution i needed to design, im new to development an asp,net and built a local post office search tool using asp.net 2. vb in visual studio, using an...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.