SIMPLE Questions Thread!

Posts 7682 of 82 · Page 6 of 6
Sorry, didn't understand what this does..
I have ToolStripMenuItem1 renamed TSGW and others renamed other suff, should this still work?

I get an error in this:
Code:
For Each n As ToolStripMenuItem In Me.Controls
Error:
Unable to cast object of type 'System.Windows.Forms.ToolStrip' to type 'System.Windows.Forms.ToolStripMenuItem'.

Do you know how to solve it?
Ps:I did rename the ToolStripMenuItem1 in the "enable1DisableRest(ToolStripMenuItem1)" to TSGW so it's not it..
Quote Originally Posted by omanel View Post
Sorry, didn't understand what this does..
I have ToolStripMenuItem1 renamed TSG and others renamed other suff, should this still work?

I get an error in this:
Code:
For Each n As ToolStripMenuItem In Me.Controls
Error:
Unable to cast object of type 'System.Windows.Forms.ToolStrip' to type 'System.Windows.Forms.ToolStripMenuItem'.

Do you know how to solve it?
Just replace "ToolStripMenuItem" with "ToolStrip" . It might solve this. I gave you a general idea, rest you can figure out !!
Quote Originally Posted by Hassan View Post
Just replace "ToolStripMenuItem" with "ToolStrip" . It might solve this. I gave you a general idea, rest you can figure out !!
thanx for trying to help me but I am not able to do it...i think I'll have to use "If's" in all of my menu items lol

Ty anyways!
you need to check if it is a ToolStripMenuItem or the menu itself, otherwise the program will be crashing like it is happening now... its like... Trying to do a Cast of a Label to a button (crash...)...

be sure to have a If to check what control is it on the collection.
I did it the hard way lol

New question:
I have several forms and I don't know why form 4 starts first instead of beeing form1..how do I fix?
Project > *Project name here* Properties > (optional: on the left click "Application") > Startup form > choose your startup form.
Quote Originally Posted by Lolland View Post
Project > *Project name here* Properties > (optional: on the left click "Application") > Startup form > choose your startup form.
Thanks, I am starting to understand vb2008 but still got lots of basic things like this to learn lol
Posts 7682 of 82 · Page 6 of 6
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?