Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declare 'withevents' for each event of MenuItem Array ??

Status
Not open for further replies.

soodvarun

Programmer
Apr 21, 2001
40
CA
Hi there !
How can we declere event for MenuItem array ?

Dim CustomMenuItems(10) As System.Windows.Forms.MenuItem

if I write
1)
WithEvents CustomMenuItems() As System.Windows.Forms.MenuItem

It says that "withevents cannot be typed as arrays"

2) Even if I write it as

WithEvents CustomMenuItems(0) As System.Windows.Forms.MenuItem

then also I get the same error.

Can anyone help me how can I trap the "click event" when a menu Item is clicked ?

 
Thx for your reply.

But then how do I get around with the problem ?

Say I have to design "context menu" depending one the number of files opened. such that each file name is there. How can I acheive this?

I am sure there must be some otherway round to get out of this problem.

Guys plz help.

thx.

 
I tried that AddHandler also but its again NOT for array objects.

:((


Ultimately I have to landup creating few MenutItem objects in advance.. and move through a huge huge huge if-else ladder to get my work done.

I know this approach is not good bu I m unable to find the solution to it.

I hope that the problem is fully understandable to you..

Thx for your reply.

Varun Sood.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top