Here are three approaches, in increasing order of preference:
1. For the invoice form, code a new constructor that takes a form as an
argument. When you create the invoice form with that constructor, pass
'this' as the argument to the constructor. In the invoice's Closing event,
it can find and enable the menu item on the form that holds the menu. This
is not so good, because it requires the invoice form to know a lot about the
logic of the form it was invoked from.
2. Same as (1), except that the invoice form, instead of finding and
enabling the menu item, calls some method on the form that holds the menu.
This method, which you create, finds and modifies the menu item. This
approach is sometimes called a 'secondary interface'. It is better than (1),
because it does not require the invoice form to know anything about how it
was invoked, but it couples the logic of the two forms pretty closely.
3. On the invoice form, create an event that the form's Closing event would
raise during its shutdown process. In the form that has the menu, wire up an
event handler to that event, and do all the menu item manipulation in that
event. This approach would be my preference, mainly because it uses an
established mechanism that's loosely-coupled.
Hope this helps,
Tom Dacon
Dacon Software Consulting
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:eH**************@TK2MSFTNGP11.phx.gbl...
I need to explain more about my purpose, In fact I know how to disable the
menu.
But , as the user close that invoice form, "the menu should be set to
enabled = true"
How can I do that ??
Thanks
"Agnes" <ag***@dynamictech.com.hk> ¦b¶l¥ó
news:On**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g... In my menu, there is invoice,customer .... etc
As the user click 'Invoice' , the invoice form is load, then I want to
disable the "Invoice" menu in the Menuitem, ,so the user can only new
one invoice form and the user can new another form like 'delivery order'..
etc. In such case, I won't use' showdialog'.
Thanks a lot
From AGnes