Sorry if this is an oft-posted question, but what is the C# equivalent of having a control array in VB6?
I know multiple controls can share the same event unlike VB6 ... if I want to enumerate over some radio buttons, say... do I just have to add them to a collection via code? 5 1401
Hi,
I'm not sure if I understood your question. Here is a try: Each Form derived
class has a Controls collection. So if you have a form with a couple of
controls on it you could enumerate them like this:
foreach (Control c in this.Controls) {
c.Enabled = false;
}
HTH,
Matthias
--
-----
fragmente einer flugbahn - http://emvoid.de
"Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> schrieb im
Newsbeitrag news:91**********************************@microsof t.com... Sorry if this is an oft-posted question, but what is the C# equivalent of
having a control array in VB6? I know multiple controls can share the same event unlike VB6 ... if I want
to enumerate over some radio buttons, say... do I just have to add them to a
collection via code?
I know it does.
It doesn't have control arrays like VB6 though?
"Matthias Steinbart" wrote: Hi,
I'm not sure if I understood your question. Here is a try: Each Form derived class has a Controls collection. So if you have a form with a couple of controls on it you could enumerate them like this:
foreach (Control c in this.Controls) { c.Enabled = false; }
HTH,
Matthias -- ----- fragmente einer flugbahn - http://emvoid.de "Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> schrieb im Newsbeitrag news:91**********************************@microsof t.com... Sorry if this is an oft-posted question, but what is the C# equivalent of having a control array in VB6? I know multiple controls can share the same event unlike VB6 ... if I want to enumerate over some radio buttons, say... do I just have to add them to a collection via code?
On 20 Jul 2004 10:12, "Beeeeeeeeeeeeves" wrote: I know it does. It doesn't have control arrays like VB6 though?
C# doesn't, nor does VB.NET I believe
"Matthias Steinbart" wrote:
Hi,
I'm not sure if I understood your question. Here is a try: Each Form derived class has a Controls collection. So if you have a form with a couple of controls on it you could enumerate them like this:
foreach (Control c in this.Controls) { c.Enabled = false; }
HTH,
Matthias -- ----- fragmente einer flugbahn - http://emvoid.de "Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> schrieb im Newsbeitrag news:91**********************************@microsof t.com... > Sorry if this is an oft-posted question, but what is the C# equivalent of having a control array in VB6? > I know multiple controls can share the same event unlike VB6 ... if I want to enumerate over some radio buttons, say... do I just have to add them to a collection via code? >
Yes. Or go through their parent control's Controls collection as Matthias
said.
--
Simon Smith
simon dot s at ghytred dot com www.ghytred.com/NewsLook - NNTP Client for Outlook
You could either add one in code as you say or if you particualry wanted to
get the designer to do the work add them into a GroupBox on the form. Then
you could have:
foreach(Control control in this.groupBox.Controls)
{
MessageBox.Show(control.Name);
}
"Simon Smith" <gh*****@community.nospam> wrote in message
news:08******************************@ghytred.com. .. On 20 Jul 2004 10:12, "Beeeeeeeeeeeeves" wrote:I know it does. It doesn't have control arrays like VB6 though?
C# doesn't, nor does VB.NET I believe
"Matthias Steinbart" wrote:
Hi,
I'm not sure if I understood your question. Here is a try: Each Form
derived class has a Controls collection. So if you have a form with a couple of controls on it you could enumerate them like this:
foreach (Control c in this.Controls) { c.Enabled = false; }
HTH,
Matthias -- ----- fragmente einer flugbahn - http://emvoid.de "Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> schrieb
im Newsbeitrag news:91**********************************@microsof t.com... > Sorry if this is an oft-posted question, but what is the C#
equivalent of having a control array in VB6? > I know multiple controls can share the same event unlike VB6 ... if I
want to enumerate over some radio buttons, say... do I just have to add them
to a collection via code? >
Yes. Or go through their parent control's Controls collection as Matthias said.
-- Simon Smith simon dot s at ghytred dot com www.ghytred.com/NewsLook - NNTP Client for Outlook
You could either add one in code as you say or if you particualry wanted to
get the designer to do the work add them into a GroupBox on the form. Then
you could have:
foreach(Control control in this.groupBox.Controls)
{
MessageBox.Show(control.Name);
}
"Simon Smith" <gh*****@community.nospam> wrote in message
news:08******************************@ghytred.com. .. On 20 Jul 2004 10:12, "Beeeeeeeeeeeeves" wrote:I know it does. It doesn't have control arrays like VB6 though?
C# doesn't, nor does VB.NET I believe
"Matthias Steinbart" wrote:
Hi,
I'm not sure if I understood your question. Here is a try: Each Form
derived class has a Controls collection. So if you have a form with a couple of controls on it you could enumerate them like this:
foreach (Control c in this.Controls) { c.Enabled = false; }
HTH,
Matthias -- ----- fragmente einer flugbahn - http://emvoid.de "Beeeeeeeeeeeeves" <Be**************@discussions.microsoft.com> schrieb
im Newsbeitrag news:91**********************************@microsof t.com... > Sorry if this is an oft-posted question, but what is the C#
equivalent of having a control array in VB6? > I know multiple controls can share the same event unlike VB6 ... if I
want to enumerate over some radio buttons, say... do I just have to add them
to a collection via code? >
Yes. Or go through their parent control's Controls collection as Matthias said.
-- Simon Smith simon dot s at ghytred dot com www.ghytred.com/NewsLook - NNTP Client for Outlook
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: The Mess |
last post by:
I would like to pass a Control array of OptionButtons that I created at run
time to a Sub.
Say I have Opt(0), Opt(1)......Opt(5) as OptionButtons, is there a way to
pass Opt to a function and...
|
by: Mani |
last post by:
Hi,
can anyone help me on how to create a control array in C++ builder
like we create in VB.
I have another question regarding controls. I want to clear a group
of text boxes in the form on a...
|
by: James McGivney |
last post by:
I have a project in ASP.NET using C#. I have a large number of Button Controls and a large number of ImageButton Controls. It would be convienent if I could refer to a specific control by it's...
|
by: Mark Broadbent |
last post by:
In VB6 (using visual studio) it was possible to create a control array at
design time by simply adding the control (e.g. textbox) and renaming it to
what would become the first element
e.g.
...
|
by: chxant |
last post by:
Hi,
I want to use a parameter in a control name.
Something like this:
i=1;
(CheckBox + i).ID="test";
Is this possible?
|
by: bienwell |
last post by:
Hi all,
Data displayed on the datalist control is bound by the column name of the
dataset like this :
<%# DataBinder.Eval(Container.DataItem, "title")%>
Could I use an element of the array...
|
by: George |
last post by:
Is there a fast way to transfer an Excel range to an array?
Example:
Excel range is E2:E300
Dim person() as string
Thanks,
George
|
by: Jim Burns |
last post by:
I just started with vb.net and I don't understand why there are no control
arrays.
what replaced them.
I was trying to do drag and drop(What happened with that) and it looked like
with no control...
|
by: Rich |
last post by:
Hello,
I have an application that contains several checkboxes. I originally
created this app in VB.Net 2003 and upgraded the app to VB.Net 2005. I
understand the vb2005 supports control...
|
by: =?Utf-8?B?VG9tbXkgTG9uZw==?= |
last post by:
I don't know if the following is what you are looking for, but to me what you
described was using a control array. If you were using vb6 that would be
easy, the following articles hopefully...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |