By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,571 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,571 IT Pros & Developers. It's quick & easy.

Disable the one item in Menu Bar

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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> 在郵件
news:On**************@TK2MSFTNGP12.phx.gbl 中撰寫...
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

Nov 20 '05 #2

P: n/a
mi.Enabled = False
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
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

Nov 20 '05 #3

P: n/a
* "Agnes" <ag***@dynamictech.com.hk> scripsit:
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'.


In the menu item's 'Click' event handler:

\\\
DirectCast(sender, MenuItem).Enabled = False
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

P: n/a
\\\
Private WithEvents MyInvoiceForm As Form

Sub InvoiceMenu_Click(...)...
InvoiceMenu.Enabled = False
MyInvoiceForm = New InvoiceForm
MyInvoiceForm.Owner = Me
MyInvoiceForm .Show
End Sub

Sub MyInvoiceForm _Closed(...)...
InvoiceMenu.Enabled = True
End Sub
///
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
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

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004
Nov 20 '05 #5

P: n/a
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> 在郵件
news:On**************@TK2MSFTNGP12.phx.gbl 中撰寫...
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


Nov 20 '05 #6

P: n/a
The following code work great : `~~
cheer ~~ and thanks Mick
"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> 在郵件
news:ui*************@TK2MSFTNGP09.phx.gbl 中撰寫...
\\\
Private WithEvents MyInvoiceForm As Form

Sub InvoiceMenu_Click(...)...
InvoiceMenu.Enabled = False
MyInvoiceForm = New InvoiceForm
MyInvoiceForm.Owner = Me
MyInvoiceForm .Show
End Sub

Sub MyInvoiceForm _Closed(...)...
InvoiceMenu.Enabled = True
End Sub
///
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
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

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.719 / Virus Database: 475 - Release Date: 12/07/2004

Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.