Solved

how can i convert it in C#.net window application ??

Posted on 2011-03-08
5
345 Views
Last Modified: 2012-05-11
currently i am creating dynamic menu in my application , for this i want to convert list of toolstripmenuitem into toolstripitemcollections , but how can i do this ??

please refer the below code ..
List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>();

Open in new window


now i want to convert above list of toolstripmenuitem in to toolstripitemcollections , but how can i do this ??
0
Comment
Question by:Parth48
5 Comments
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 35068582
Not sure I follow what it is you are after, can you explain in some more detail please about what you hope to achieve?
0
 
LVL 5

Expert Comment

by:mayankagarwal
ID: 35068589
0
 

Author Comment

by:Parth48
ID: 35068639
but how can i convert it into toolstripitemcollections ??
0
 

Author Comment

by:Parth48
ID: 35068663
it's actually needed when u add items to the menustrip ...

please refer the below code ...

MenuStrip menuItems = new MenuStrip();

menuitems.Items.AddRange(toolstripitemcollections);

Open in new window


referring above code i have to need toolstripitemcollections class ...

what can i do now ??
0
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 35071733
It should be something like this:

List<ToolStripMenuItem> menuItems = new List<ToolStripMenuItem>();
ToolStrip yourToolStrip = new ToolStrip();

//  ... your code to add ToolStripMenuItem's

ToolStripItemCollection stripCol = new ToolStripItemCollection(yourToolStrip, menuItems.ToArray());

// Or, if the ToolStripItemCollection is already created
stripCol.AddRange(menuItems.ToArray());

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now