473,324 Members | 2,501 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,324 software developers and data experts.

Disable the one item in Menu Bar

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
6 2016
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

Nov 20 '05 #2
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
* "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
\\\
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
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


Nov 20 '05 #6
The following code work great : `~~
cheer ~~ and thanks Mick
"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> ¦b¶l¥ó
news:ui*************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
\\\
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lijun Yang | last post by:
Hey, I am able to disable the right mouse button on images for netscape and IE but it won't work for Opera. Here is the code: // start of the code var clickmessage="Sorry, you don't have...
3
by: Richard Cleaveland | last post by:
I want to dim (disable) a specific menu item dropped down from a toolbar menu item. I looked for a property I could change but no luck. Access 97. Suggestions?
5
by: Brian Henry | last post by:
I have a form with a main menu on it (mdi parent form) and i have a child form with a menu and I am mergeing the menus together for the menu called reports.. now when i do this they merge just...
2
by: DNK | last post by:
I have an MDIParent and a menu item "Show Status". By clicking on it, 'Show Status' Child Window has to be opened & Menu has to be disabled. by closing the Child menu has to be enabled. How...
8
by: Nemo | last post by:
Hello Guys, Can somebody tell me how I can disable a menu item such as "save as" in the Internet Explorer or Netscape using Javascript. Thanks. Nemo
1
by: John Devlon | last post by:
Hi, Can someone please help me. I've got a strang problem in Visual Studio 2005 I've created a windows application, using an MDI form and top menu. When a menu item is clicked, a new instance...
1
by: coolarian | last post by:
Hi, I have an C# MDI application. There are three mdi childs, mdiFormA, childB and childC. childA is loaded in the parent by default as below: private void TestingMenu_Load(object sender,...
1
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Hi, friends, I am using C#.net 2005 to create a windows application. It has menu items, such as File, etc. Under File, there are more menu items, such as New Files, Working Files, etc. Under...
56
by: Deepan HTML | last post by:
Hi All, Currently i am working in a framed environment where i have divided the window as 20% and 80% and the 20% is used for navigation purpose and right frame for displaying the orignal content....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.