473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

A-Control Array ?

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 array I have to write code in for every control?
That cant be possible.
I looked at the help files and it looks like I can set an event handler but
there has to be a better way then typing Handles pic1.click,pic2.click
It would be a lot of typing for 60 controls
Nov 21 '05 #1
14 1547
Jim,

This newsgroups is full of your question.

The term "Control Array" as it was in VB6 is no more.

There are still arrays of controls, even more, every control has a control
array where in are the childs controls again.

However there is not any more a property for that in the Ide. The array
(collection) is standard in the parent control object (although you can
simulate tho get any control using an array by instance using an hashtable
or any other collection/array).

(Do not forget where VB6 has only the collection and the array, has dotNet
much more for that and much more dynamicly)

Form
panel1
textbox1
textbox2
panel2
textbox3
button1

Form has in its control array (collection) panel1 and panel2
Panel1 has in its control collection textbox1 and textbox2
Panel2.....

I hope this helps?

Cor
Nov 21 '05 #2
Jim,

This newsgroups is full of your question.

The term "Control Array" as it was in VB6 is no more.

There are still arrays of controls, even more, every control has a control
array where in are the childs controls again.

However there is not any more a property for that in the Ide. The array
(collection) is standard in the parent control object (although you can
simulate tho get any control using an array by instance using an hashtable
or any other collection/array).

(Do not forget where VB6 has only the collection and the array, has dotNet
much more for that and much more dynamicly)

Form
panel1
textbox1
textbox2
panel2
textbox3
button1

Form has in its control array (collection) panel1 and panel2
Panel1 has in its control collection textbox1 and textbox2
Panel2.....

I hope this helps?

Cor
Nov 21 '05 #3
On Mon, 10 Jan 2005 10:06:46 -0500, "Jim Burns" <Ji****@comcast.net> wrote:

¤ 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 array I have to write code in for every control?
¤ That cant be possible.
¤ I looked at the help files and it looks like I can set an event handler but
¤ there has to be a better way then typing Handles pic1.click,pic2.click
¤ It would be a lot of typing for 60 controls

That is pretty much the recommended method since controls have no built-in index property.

http://msdn.microsoft.com/library/de...albasicnet.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #4
On Mon, 10 Jan 2005 10:06:46 -0500, "Jim Burns" <Ji****@comcast.net> wrote:

¤ 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 array I have to write code in for every control?
¤ That cant be possible.
¤ I looked at the help files and it looks like I can set an event handler but
¤ there has to be a better way then typing Handles pic1.click,pic2.click
¤ It would be a lot of typing for 60 controls

That is pretty much the recommended method since controls have no built-in index property.

http://msdn.microsoft.com/library/de...albasicnet.asp
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #5
"Jim Burns" <Ji****@comcast.net> schrieb:
I just started with vb.net and I don't understand why there are no control
arrays.
what replaced them.
Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>
I was trying to do drag and drop(What happened with that) and it looked
like
with no control array I have to write code in for every control?
That cant be possible.
I looked at the help files and it looks like I can set an event handler
but
there has to be a better way then typing Handles pic1.click,pic2.click
It would be a lot of typing for 60 controls


You can loop through the controls and use 'AddHandler' to add a handler to
the controls' events.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
"Jim Burns" <Ji****@comcast.net> schrieb:
I just started with vb.net and I don't understand why there are no control
arrays.
what replaced them.
Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>
I was trying to do drag and drop(What happened with that) and it looked
like
with no control array I have to write code in for every control?
That cant be possible.
I looked at the help files and it looks like I can set an event handler
but
there has to be a better way then typing Handles pic1.click,pic2.click
It would be a lot of typing for 60 controls


You can loop through the controls and use 'AddHandler' to add a handler to
the controls' events.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Cor, when you have a form with the two panels with children textboxes, when
you enumerate all the controls on the form, are just the Panel 1 and Panel 2
enumerated or are all the children of the Panel 1 and Panel 2 enumerated as
well?

"Cor Ligthert" wrote:
Jim,

This newsgroups is full of your question.

The term "Control Array" as it was in VB6 is no more.

There are still arrays of controls, even more, every control has a control
array where in are the childs controls again.

However there is not any more a property for that in the Ide. The array
(collection) is standard in the parent control object (although you can
simulate tho get any control using an array by instance using an hashtable
or any other collection/array).

(Do not forget where VB6 has only the collection and the array, has dotNet
much more for that and much more dynamicly)

Form
panel1
textbox1
textbox2
panel2
textbox3
button1

Form has in its control array (collection) panel1 and panel2
Panel1 has in its control collection textbox1 and textbox2
Panel2.....

I hope this helps?

Cor

Nov 21 '05 #8
Cor, when you have a form with the two panels with children textboxes, when
you enumerate all the controls on the form, are just the Panel 1 and Panel 2
enumerated or are all the children of the Panel 1 and Panel 2 enumerated as
well?

"Cor Ligthert" wrote:
Jim,

This newsgroups is full of your question.

The term "Control Array" as it was in VB6 is no more.

There are still arrays of controls, even more, every control has a control
array where in are the childs controls again.

However there is not any more a property for that in the Ide. The array
(collection) is standard in the parent control object (although you can
simulate tho get any control using an array by instance using an hashtable
or any other collection/array).

(Do not forget where VB6 has only the collection and the array, has dotNet
much more for that and much more dynamicly)

Form
panel1
textbox1
textbox2
panel2
textbox3
button1

Form has in its control array (collection) panel1 and panel2
Panel1 has in its control collection textbox1 and textbox2
Panel2.....

I hope this helps?

Cor

Nov 21 '05 #9
Dennis,

In the collection of the form (you use "me." for that) are only the controls
that are its child.

When you want to use only some controls you can make your own array with
controls, wherever the control is on the form.

dim MyToUseControls() as Controls = {button1, button2, textbox1, etc)

When you want to get every control in an form it can be more a problem.
However I made once a recursive routine that find all controls in a form,
without trying to find how deep it is.

I showed it yesterday in a "class" in this newsgroup (OP was Stefan it in
the thread that started 2 after (in time so probably above) yours and with
that could use it in one time for the complete application.

I hope this gives some ideas?

Cor

Nov 21 '05 #10
Isn't it so much simpler to copy paste 20 Image controls on a form ,vb
Index's for you . You double click on any image and vb sets up a event
handler for you .
Why would they take such functionality out.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OP**************@TK2MSFTNGP12.phx.gbl...
Dennis,

In the collection of the form (you use "me." for that) are only the controls that are its child.

When you want to use only some controls you can make your own array with
controls, wherever the control is on the form.

dim MyToUseControls() as Controls = {button1, button2, textbox1, etc)

When you want to get every control in an form it can be more a problem.
However I made once a recursive routine that find all controls in a form,
without trying to find how deep it is.

I showed it yesterday in a "class" in this newsgroup (OP was Stefan it in
the thread that started 2 after (in time so probably above) yours and with
that could use it in one time for the complete application.

I hope this gives some ideas?

Cor



Nov 21 '05 #11
Jim,

That part what can be simpler can be a long discussion, I have beside things
that where in VB6 and not in VBNet a lot of things that can in my opinion be
simpler without even looking at VB6. By instance in the next version is the
creating from an event in VB style disapeared and it becomes C# style. I
find that as well a pity although in C# you can give your procedures a name
yourself.

However I am not the designer, that is the same probably as with your
clients when you change on good grounds parts. Than the user is after using
it a while is very happy with it, however for the first time he uses it
don't understand why he cannot use that old ones.

Looking at the past is for me not always the best measurement tool for that.
Sometimes you have to make decisions which can be an improvement for the
feature.

There are much more special designing tools from VB6 deleted. However there
are brought back a lot with a much wider scoop. For me this makes the
difference for using end user tools as Ms-Access or a programming tool as
VBNet is. I see VB6 as a kind of hybrid.

However just my opinion.

Cor
Nov 21 '05 #12
I just became aware of all the controversy in the vb community on the .net
isn't vb thing . However .net is vb7 no mater what people say.
there is a lot of cool stuff in .net but I like using control arrays and the
class builder tool.
I'm learning .net from videos and about 2 hours ago I just did the lesson on
Extender controls.
Tonight I will start building A control Array ex tool That when dropped on a
form It will give some controls the ability to become control arrays by
right clicking on the control and selecting control array.
Its not so much that I cling to the past more like why should I go with out
control Arrays Because MS left them out When I could simple put then back
in, or actually mimic them with a collection and a vb6 like user feel.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Ol****************@TK2MSFTNGP12.phx.gbl...
Jim,

That part what can be simpler can be a long discussion, I have beside things that where in VB6 and not in VBNet a lot of things that can in my opinion be simpler without even looking at VB6. By instance in the next version is the creating from an event in VB style disapeared and it becomes C# style. I
find that as well a pity although in C# you can give your procedures a name yourself.

However I am not the designer, that is the same probably as with your
clients when you change on good grounds parts. Than the user is after using it a while is very happy with it, however for the first time he uses it
don't understand why he cannot use that old ones.

Looking at the past is for me not always the best measurement tool for that. Sometimes you have to make decisions which can be an improvement for the
feature.

There are much more special designing tools from VB6 deleted. However there are brought back a lot with a much wider scoop. For me this makes the
difference for using end user tools as Ms-Access or a programming tool as
VBNet is. I see VB6 as a kind of hybrid.

However just my opinion.

Cor


Nov 21 '05 #13

"Jim Burns" <Ji****@comcast.net> wrote in message
news:FN********************@comcast.com...
I just became aware of all the controversy in the vb community on the .net
isn't vb thing . However .net is vb7 no mater what people say.


No it's not...
Nov 21 '05 #14
Noozer Its bad enough when I post a ? on vb news groups I get shit about it
not being Visual Basics, But this is a vb.net group and some of use are
having a discussion. No one needs to hear your crying shit hear.
"Noozer" <do*******@me.here> wrote in message
news:Oi****************@TK2MSFTNGP15.phx.gbl...

"Jim Burns" <Ji****@comcast.net> wrote in message
news:FN********************@comcast.com...
I just became aware of all the controversy in the vb community on the ..net isn't vb thing . However .net is vb7 no mater what people say.


No it's not...


Nov 21 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian | last post by:
I'm diddlying with a script, and found some behavior I don't understand. Take this snippet: for ($i = 0; $i <= count($m); $i++) { array_shift($m); reset($m); }
2
by: Stormkid | last post by:
Hi Group I'm trying to figure out a way that I can take two (two dimensional) arrays and avShed and shed, and subtract the matching elements in shed from avShed I've pasted the arrays blow from a...
15
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
8
by: vcardillo | last post by:
Hello all, Okay, I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array(...
12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
35
by: VK | last post by:
Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>
11
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not...
5
by: ritchie | last post by:
Hi, I am writing to ask if anyone can see why my array is not being sorted correctly? It's an array of 4 elements(ints 1,2,3,4) but after calling the selection sort it comes back sorted as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.