[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Control array in windows form?

Posted on 2006-05-31
Medium Priority
Last Modified: 2010-04-16
Hi there,

I am sure this is easy but I have been using asp.net for a while and now need to use windows forms..

In vb6 i used to create like 10 checkboxes for example... named them all the same and it automatically created an array as they were all called the same but in visual studio 2005 it doesn't seem to let me do this

Am i doing osmething wrong?

Surley i don't have to create 10 checkboxes called "checkbox1", Checkbox2, checkbox3??

Thnaks in advance

Question by:ianinspain
LVL 44

Assisted Solution

bruintje earned 1000 total points
ID: 16799153
Hi ianinspain,

you can create your own control array class to replicate that behaviour from VB6 it lookes like a bit more work but in the end you got more control on the details if needed later in the project

there is a 2 part article handles the finesses of the changes in depth

share what you know, learn what you don't

Accepted Solution

GENTP earned 1000 total points
ID: 16799186
"In Visual Basic 6.0, control arrays could be used to specify a group of controls that shared a set of events. The controls had to be of the same type, and they had to have the same name.

In Visual Basic .NET, control arrays are no longer supported. Changes to the event model make control arrays unnecessary. Just as control arrays in Visual Basic 6.0 could share events, the event model in Visual Basic .NET allows any event handler to handle events from multiple controls. In effect, this allows you to create groups of controls of disparate types that share the same events."

That came straight out of the MSDN Library.

I suggestion is for you to name them all differently and have all their event method point to a common function. Use the object sender to determine which object it is. I have never done this before, but this is the way i'd probably go about it.


LVL 96

Expert Comment

by:Bob Learned
ID: 16801908
You can easily work around not having control arrays.


Author Comment

ID: 16815022
thanks,.... Was thinking like VB :-)

Thanks again


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 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