473,379 Members | 1,255 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,379 software developers and data experts.

Control arrays converted from VB6

In VB6 I made heavy use of control arrays
I see they have been 'deprecated' in vb.Net, with a questionable explanation
that they are no longer necessary which just addresses the event issue!
Problem is I commonly associated several other controls with the same index
inside the event handler - eg a
Directory listbox, Label, Checkbox, Textbox Drivebox etc all associated with
identical index.

Now I see Control arrays belong to VB6 compatibility.

So how in a converted VB6 program can I extend the control arrays at design
time? or run-time for that matter?

I guess VB6 compatibility creates a run-time array of controls with related
type and names - am I right?

So do I need to create a Control object array at form load time, and replace
control references with array references? Is that how VB6 compatibility
does it?

How do other people handle control arrays in .Net

Thanks!
Nov 21 '05 #1
8 2287
Sorry - double post due to Outlook-Express reported server error

Nov 21 '05 #2
Greg,

This newsgroups is full of this.

In VBNet has every control an controlcollection. That is as well for the
form itself.

However what you probably need is something as
\\\
dim ctrArray() as Control = Control() {textbox1, textbox2, combobox1, etc}
///
When you use it with a special property/method of a control (not needed for
by instance "name") than you have to do
\\\
If typeof ctr(x) Is combobox then
directcast(ctr,combobox).selectedindex = 1
End it
///
I hope this helps?

Cor
"Greg" <Gr**@discussions.microsoft.com>
In VB6 I made heavy use of control arrays
I see they have been 'deprecated' in vb.Net, with a questionable
explanation
that they are no longer necessary which just addresses the event issue!
Problem is I commonly associated several other controls with the same
index
inside the event handler - eg a
Directory listbox, Label, Checkbox, Textbox Drivebox etc all associated
with
identical index.

Now I see Control arrays belong to VB6 compatibility.

So how in a converted VB6 program can I extend the control arrays at
design
time? or run-time for that matter?

I guess VB6 compatibility creates a run-time array of controls with
related
type and names - am I right?

So do I need to create a Control object array at form load time, and
replace
control references with array references? Is that how VB6 compatibility
does it?

How do other people handle control arrays in .Net

Thanks!

Nov 21 '05 #3
Thanks for your reply - I was hoping to find something to give me DESIGN Time
control arrays; I think Ken Tucker and Herfried Wagner have answered my
question in the double-posted thread; thank you

But it's no surprise that the Group is full of this particular issue! It
was quite a shock to find something so useful and flexible discarded with no
obvious benefit

"Cor Ligthert" wrote:
Greg,

This newsgroups is full of this.

In VBNet has every control an controlcollection. That is as well for the
form itself.

However what you probably need is something as
\\\
dim ctrArray() as Control = Control() {textbox1, textbox2, combobox1, etc}
///
When you use it with a special property/method of a control (not needed for
by instance "name") than you have to do
\\\
If typeof ctr(x) Is combobox then
directcast(ctr,combobox).selectedindex = 1
End it
///
I hope this helps?

Cor
"Greg" <Gr**@discussions.microsoft.com>
In VB6 I made heavy use of control arrays
I see they have been 'deprecated' in vb.Net, with a questionable
explanation
that they are no longer necessary which just addresses the event issue!
Problem is I commonly associated several other controls with the same
index
inside the event handler - eg a
Directory listbox, Label, Checkbox, Textbox Drivebox etc all associated
with
identical index.

Now I see Control arrays belong to VB6 compatibility.

So how in a converted VB6 program can I extend the control arrays at
design
time? or run-time for that matter?

I guess VB6 compatibility creates a run-time array of controls with
related
type and names - am I right?

So do I need to create a Control object array at form load time, and
replace
control references with array references? Is that how VB6 compatibility
does it?

How do other people handle control arrays in .Net

Thanks!


Nov 21 '05 #4
Greg,
But it's no surprise that the Group is full of this particular issue! It
was quite a shock to find something so useful and flexible discarded with
no
obvious benefit

Only from persons who come just from VB6. After a while they don't want that
probably no more because there are so much VBNet methods which give more
control to do what you want, almost endless and when you know them easier to
use.

Cor
Nov 21 '05 #5
"Cor Ligthert" <no************@planet.nl> schrieb:
But it's no surprise that the Group is full of this particular issue! It
was quite a shock to find something so useful and flexible discarded with
no
obvious benefit


Only from persons who come just from VB6. After a while they don't want
that probably no more because there are so much VBNet methods which give
more control to do what you want, almost endless and when you know them
easier to use.


I disagree. Control arrays were one important part of the real RAD
experience of VB Classic, because they provided an easy-to-use design-time
support.

--
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
Herfried,

I know that you disagree that, I have often seen that in this newsgroup.

It is often that people love there first programming language they were real
active with and cannot see the worse things of it.

However an advise try to leave that behaviour.

Learn to look at your first programminglanguage even with more distance than
others.

And watch to embrace not directly any marketing message that fits what you
want to see. When others who never used VB6 however are expirienced in VBNet
that it is good, than you have a better measuring point.

And those people are probably even younger than you.

However just an advise feel free to do with it what you want.

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
"Cor Ligthert" <no************@planet.nl> schrieb:
But it's no surprise that the Group is full of this particular issue!
It
was quite a shock to find something so useful and flexible discarded
with no
obvious benefit


Only from persons who come just from VB6. After a while they don't want
that probably no more because there are so much VBNet methods which give
more control to do what you want, almost endless and when you know them
easier to use.


I disagree. Control arrays were one important part of the real RAD
experience of VB Classic, because they provided an easy-to-use design-time
support.

--
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 Ligthert" <no************@planet.nl> schrieb:
It is often that people love there first programming language they were
real active with and cannot see the worse things of it.
VB Classic was not my first programming language.
However an advise try to leave that behaviour.


Why? Give me some reasons why control arrays (+ design-time support) are so
bad that I should not use them.

--
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 #8
> "Cor Ligthert" <no************@planet.nl> schrieb:
It is often that people love there first programming language they were
real active with and cannot see the worse things of it.


VB Classic was not my first programming language.

I took a long time to describe it the way I did, to avoid this message
however I did not succeed. I know that already, however in my opinion is VB6
the the first you embraced.

:-)
However an advise try to leave that behaviour.


Why? Give me some reasons why control arrays (+ design-time support) are
so bad that I should not use them.


It is not the discussing point, the point is that the ones who want to
discuss this have all a very deep VB6 background. That does not mean I did
not used it, however I am almost forgotten what it was.

The only thing I rembember me is that I first found it sad that the control
array was gone, and now that I have seen so much better aproaches for that
am afraid that it comes back and people start using it again.

I thought to remember me that it was one of my first questions in this
newsgroup which you answered. (Beside that favorites, what still is great,
was it I thought as well one of your last answers on programming questions
from me)

:-).

Cor

Nov 21 '05 #9

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

Similar topics

19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
34
by: Christopher Benson-Manica | last post by:
If an array is sparse, say something like var foo=; foo=4; foo='baz'; foo='moo'; is there a way to iterate through the entire array? --
4
by: Hal Styli | last post by:
/*hello could someone please help me with the errors i get related to pointers to arrays of ints. I want to declare something like int *d = { 7, 11, 18, 54, 64, 55, 37, 38, }; rather than...
9
by: Merrill & Michele | last post by:
What follows is an adaptation of the second program in K&R §5.10. The changes are to elucidate (validate) the difference (sameness) of char * and char**. I cannot for the life of me understand...
4
by: Greg Lesnie | last post by:
In VB6 I made heavy use of control arrays I see they have been 'deprecated' in vb.Net, with a questionable explanation that they are no longer necessary! Problem is I commonly associated several...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
3
by: ZMan | last post by:
The following code won't compile with gcc version 3.4.2 (mingw-special). How come? Error: cannot convert `char (*)' to `char**' /**********************************************************/...
2
by: Jess | last post by:
Hello, I understand that if an array is illegal in some particular context, then its name will be converted to a pointer. For example, if int a = {1,2,3}; then a function void f(int* a);
152
by: vippstar | last post by:
The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array = { {...
0
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...
0
isladogs
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...
0
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...
0
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,...
0
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...
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?
1
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 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.