List Info

Thread: Can't Disable X on Mdiform




Can't Disable X on Mdiform
user name
2006-12-22 19:43:29
It looks like they don't have any way to stop the user from 
accidentally closing a mdiform.  That's strange because this
form is 
often used as a master menu for all forms.  If the user
accidentally 
closes it, he has now way of recovering it without
rebooting.  What if 
the form has a save on it, then he can't save his work
before rebooting.

I tried creating an unload event.  In the event I said
"me.show", but 
it ignored this.  I also tried MDIForm1.show and it ignored
this too.

On another note, I discovered something that I never knew
before.  
Excuse me if everyone knew this before, but if you want to
indent 
several lines of code, simply highlight them, then press
TAB.  To 
unindent them press SHIFT TAB.

---Anthony



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://grou
ps.yahoo.com/group/helpwithvb/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://
groups.yahoo.com/group/helpwithvb/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:helpwithvb-digest@yahoogroups.com 
    mailto:helpwithvb-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    helpwithvb-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 
Re: Can't Disable X on Mdiform
country flaguser name
United States
2007-02-19 23:50:18
If you're using VB-6, check out the QueryUnload procedure in
the 
MDI's code window.  You can set the CANCEL property to TRUE,
and 
avoid unloading the form that way.


--- In helpwithvb@yahoogroups.com, "Have A.
Niceday" <halfof4is2...> 
wrote:
>
> It looks like they don't have any way to stop the user
from 
> accidentally closing a mdiform.  That's strange because
this form 
is 
> often used as a master menu for all forms.  If the user

accidentally 
> closes it, he has now way of recovering it without
rebooting.  What 
if 
> the form has a save on it, then he can't save his work
before 
rebooting.
> 
> I tried creating an unload event.  In the event I said
"me.show", 
but 
> it ignored this.  I also tried MDIForm1.show and it
ignored this 
too.
> 
> On another note, I discovered something that I never
knew before.  
> Excuse me if everyone knew this before, but if you want
to indent 
> several lines of code, simply highlight them, then
press TAB.  To 
> unindent them press SHIFT TAB.
> 
> ---Anthony
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://grou
ps.yahoo.com/group/helpwithvb/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://
groups.yahoo.com/group/helpwithvb/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:helpwithvb-digest@yahoogroups.com 
    mailto:helpwithvb-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    helpwithvb-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

RE: Re: Can't Disable X on Mdiform
country flaguser name
United States
2007-02-20 07:39:14
>> " You can set the CANCEL property to TRUE,
and.
>>   avoid unloading the form that way. "

Very true, but we need a test of some type
to determine, or verify, that the Cancel
operation is warranted.

User has pressed the " X " Close Button:

The normal way to do this is to inspect the
value of the UnloadMode variable that the
operating system fills for the Query Unload
Event Handler.

If the value is [ ? ] then ask the User if they
really want to close the form, and should
any unsaved work be saved, et cetera.

[ ? ]
If I recall, the UnloadMode variable can have
one of four values, but I don't recall what
the correct value would be for hitting the 'X'.

A new (small) project, with a MessageBox in the
Query Unload could easily display the value
when you use the 'X' button to close the form.

( Update: see code below )

It should be an Integer if I recall correctly.

Ken Ives use to have a sample project for this,
over at Free VB Code dot Com, but I don't see it.

Found This:
http://vb-helper.com/t
ips3.htm

Have you ever wondered what events fire when 
you close a form ?  These events fire in this order: 

Form_QueryUnload 
Form_Unload 
Terminate 

I feel you have the most control in the 
Form_QueryUnload event and that's my opinion.
 
    Private Sub Form_QueryUnload(Cancel As Integer, _
        UnloadMode As Integer)

    ' ---------------------------------------------------
    ' Cancel default is zero.  Setting Cancel to
    ' a non-zero value will stop all forms from unloading.
    ' ---------------------------------------------------

    ' ---------------------------------------------------
    ' Based on the the UnloadMode code
    ' the system passes, we determine what to do.
    ' Place your specific code under the
    ' appropriate case statement.
    ' ---------------------------------------------------

    Select Case UnloadMode
            Case 0:
                ' User used the Control Box Menu in the
upper
                ' left corner or the "X" in the
upper right
                ' corner of the form.  If this is one of
many
                ' forms, I send it back to the form that
called it.
                ' One way in, one way out.

            Case 1:
                ' Some other code within this application is
causing
                ' the shutdown.  Usually a routine in a BAS
module.

            Case 2:
                ' Windows session is closing (i.e. Start,
Shut Down)

            Case 3:
                ' Task Manager is closing this application. 
(i.e.
                ' Ctrl+Alt+Del, End Task)

            Case 4:
                ' The MDI parent form is closing.

        End Select
    End Sub


All The Best,
Steve
.
0838 AM EST Tuesday, February 20, 2007
.
Disable the Close Button on a Form
http:/
/www.freevbcode.com/ShowCode.Asp?ID=2448
.
.
.
________________________________________
From: helpwithvb@yahoogroups.com
[mailto:helpwithvb@yahoogroups.com] 
On Behalf Of Richard
Sent: Tuesday, February 20, 2007 12:50 AM
To: helpwithvb@yahoogroups.com
Subject: [helpwithvb] Re: Can't Disable X on Mdiform

If you're using VB-6, check out the QueryUnload procedure in
the 
MDI's code window. You can set the CANCEL property to TRUE,
and 
avoid unloading the form that way.

--- In helpwithvb@yahoogroups.com, "Have A.
Niceday" <halfof4is2...> 
wrote:
>
> It looks like they don't have any way to stop the user
from 
> accidentally closing a mdiform. That's strange because
this form 
is 
> often used as a master menu for all forms. If the user

accidentally 
> closes it, he has now way of recovering it without
rebooting. What 
if 
> the form has a save on it, then he can't save his work
before 
rebooting.
> 
> I tried creating an unload event. In the event I said
"me.show", 
but 
> it ignored this. I also tried MDIForm1.show and it
ignored this 
too.
> 
> On another note, I discovered something that I never
knew before. 
> Excuse me if everyone knew this before, but if you want
to indent 
> several lines of code, simply highlight them, then
press TAB. To 
> unindent them press SHIFT TAB.
> 
> ---Anthony
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://grou
ps.yahoo.com/group/helpwithvb/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://
groups.yahoo.com/group/helpwithvb/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:helpwithvb-digest@yahoogroups.com 
    mailto:helpwithvb-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    helpwithvb-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )