PC Review


Reply
Thread Tools Rate Thread

Disable the one item in Menu Bar

 
 
Agnes
Guest
Posts: n/a
 
      17th Jul 2004
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


 
Reply With Quote
 
 
 
 
Agnes
Guest
Posts: n/a
 
      17th Jul 2004
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" <(E-Mail Removed)> 在郵件
news:(E-Mail Removed) 中撰寫...
> 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
>
>



 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      17th Jul 2004
mi.Enabled = False


--

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

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

"Agnes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      17th Jul 2004
* "Agnes" <(E-Mail Removed)> 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/>
 
Reply With Quote
 
Mick Doherty
Guest
Posts: n/a
 
      17th Jul 2004
\\\
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
Tom Dacon
Guest
Posts: n/a
 
      17th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> 在郵件
> news:(E-Mail Removed) 中撰寫...
> > 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
> >
> >

>
>



 
Reply With Quote
 
Agnes
Guest
Posts: n/a
 
      20th Jul 2004
The following code work great : `~~
cheer ~~ and thanks Mick
"Mick Doherty"
<EXCHANGE#(E-Mail Removed).[mdaudi100#ntlworld.com]> 在郵件
news:(E-Mail Removed) 中撰寫...
> \\\
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable menu item and its sub menu items? =?Utf-8?B?QW5kcmV3?= Microsoft Dot NET Framework 2 13th Aug 2007 04:46 PM
How to disable a menu item and all its sub menu items? =?Utf-8?B?QW5kcmV3?= Microsoft Dot NET Framework Forms 1 10th Aug 2007 12:36 AM
Disable a Menu Item - Should be Simple??? =?Utf-8?B?cG9ya28=?= Microsoft Dot NET Framework Forms 2 19th May 2006 03:49 PM
How to disable an item in a menu. =?Utf-8?B?SmFtZXMgRC4=?= Microsoft Access 2 3rd Apr 2006 07:53 PM
Disable Menu Item OCI Microsoft Excel Programming 0 19th May 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:50 AM.