I have declare a array variable in module, i need to access this variable to ToolStripMenuItem_Click Event. but i can't, when type that variable it shows "Class 'System.Windows.Forms.ToolStripMenuItem' cannot be indexed because it has no default property"

Please anyone help me

Recommended Answers

All 3 Replies

I have declare a array variable in module, i need to access this variable to ToolStripMenuItem_Click Event.

Declare the array public. For example, Public MyArray() As Integer

when type that variable it shows "Class 'System.Windows.Forms.ToolStripMenuItem' cannot be indexed because it has no default property"

You're trying to access ToolStripMenuItem's item with a code similar to ctlToolStrip(0) . Change it to ctlToolStrip.Items.Item(0) HTH

hi dear,
i declare the variable as public only... i want to use this variable in mdi form ToolStripMenuItem_Click event...
ie) before i show any form, i need to check the variable

for example,
i declare in module like
" Public Menu_201(1000) As String
and access in mdi form "ToolStripMenuItem_Click event" like
if Menu_201(201)="ABC" then
some thing i need to write here
end if

" Public Menu_201(1000) As String

Quote ("-character) was a typing error, right?

i declare the variable as public only

If you've declared that array as public it is visible to your form(s).

i want to use this variable in mdi form ToolStripMenuItem_Click event...
ie) before i show any form, i need to check the variable

How is it raised or what does raise that click-event?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.