By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

control array

P: n/a
Can anyone show me how to make control array like created in vb6?

I am making one program in vb.net 2002 using winsock control (provided with vb6). so whenever new connection request comes, it loads new winsock control. this program i can make it in vb 6. but i want to use the same technology with vb.net 2002 using winsock control only.

thanks in advance,

K
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Kishan,

You cannot make a controlarray as in VB6 (whatever that is) in VBNet.

However you can make for every control an array of controls by instance
doing this
\\\
dim myformcontrols() as control = New Control() {textbox1, button2, etc}
///
You can make as much arrays of controls as you want.

Every control holds itself already a collection of all the controls it
contents which is by instance accessable by
\\\
for each ctr as control in me.controls
ctr.text = "mytext"
next
///
With this your controls on a form have all the text "mytext"

I hope this helps?

Cor

"Kishan Hathiwala" <ki****@hathiwala.fateback.com>
Can anyone show me how to make control array like created in vb6?

I am making one program in vb.net 2002 using winsock control (provided with
vb6). so whenever new connection request comes, it loads new winsock
control. this program i can make it in vb 6. but i want to use the same
technology with vb.net 2002 using winsock control only.

thanks in advance,

K
Nov 21 '05 #2

P: n/a
Actually, there is no control arrays in VB.NET because event handlers can be
shared using the Handles keyword. Check this article for more info:
http://msdn.microsoft.com/library/de...trolarrays.asp

"Kishan Hathiwala" <ki****@hathiwala.fateback.com> wrote in message
news:#$**************@TK2MSFTNGP10.phx.gbl...
Can anyone show me how to make control array like created in vb6?

I am making one program in vb.net 2002 using winsock control (provided with
vb6). so whenever new connection request comes, it loads new winsock
control. this program i can make it in vb 6. but i want to use the same
technology with vb.net 2002 using winsock control only.

thanks in advance,

K
Nov 21 '05 #3

P: n/a
thanks for your reply...

this is what i do in vb6 when used to use it.

client side coding:
put a command button and winsock control naming btntemp and wsktemp.
And assume that server where this client will connect is "tempserver"

btntemp click event
wsktemp.close
wsktemp.connect "tempserver", 8547
wsktemp connect event:
msgbox "winsock connected"

wsktemp error event:
msgbox description

server side coding:
put a textbox and winsock control naming txttemp and wsktemp.
and change the following property of wsktemp.
index = 0

form load event:
wsktemp(0).close
wsktemp(0).localport = 8547
wsktemp(0).listen

wsktemp connectionrequest event:
load wsktemp(wsktemp.ubound + 1)
wsktemp(wsktemp.ubound).close
wsktemp(wsktemp.ubound).accept (requestid)

wsktemp error event:
msgbox description
thats it...
now if i want to write the same kind of codding in vb.net, is it possible to write? if it is then can you just show with sample coding?

thanks.

K
Nov 21 '05 #4

P: n/a
Hi Kishan,

When you want detailed Upgrade information than I advise you to ask this as
well in the newsgroup
microsoft.public.dotnet.languages.vb.upgrade

In that newsgroup Herfried (I call it often Herfrieds own newsgroup) and
others takes mostly some more time to give answers on this kind of
questions.

However when you want help from Herfried and others it is better to set your
message not in HTML because mostly by instance Herfried ignores that when he
is short of time.

Cor

"Kishan Hathiwala" ki****@hathiwala.fateback.com

thanks for your reply...

this is what i do in vb6 when used to use it.

client side coding:
put a command button and winsock control naming btntemp and wsktemp.
And assume that server where this client will connect is "tempserver"

btntemp click event
wsktemp.close
wsktemp.connect "tempserver", 8547
wsktemp connect event:
msgbox "winsock connected"

wsktemp error event:
msgbox description

server side coding:
put a textbox and winsock control naming txttemp and wsktemp.
and change the following property of wsktemp.
index = 0

form load event:
wsktemp(0).close
wsktemp(0).localport = 8547
wsktemp(0).listen

wsktemp connectionrequest event:
load wsktemp(wsktemp.ubound + 1)
wsktemp(wsktemp.ubound).close
wsktemp(wsktemp.ubound).accept (requestid)

wsktemp error event:
msgbox description
thats it...
now if i want to write the same kind of codding in vb.net, is it possible to
write? if it is then can you just show with sample coding?

thanks.

K
Nov 21 '05 #5

P: n/a
Cor Ligthert wrote:
Kishan,

You cannot make a controlarray as in VB6 (whatever that is)


Hopefully, you're joking (you must be). VB6, aka VB.Cool, aka VB Classic
is the last release of Visual anything that actually used the Basic
language. It was the last release of a development tool that could
actually read/use code from previous versions up to and including 10+
year old versions. In fact, most Basic code ran find in VB6. Even late
1970's DOS basic with minor modifications.

No comparison to this new "throw my code away for each new release" B#

fwiw, VB Classic code's safer too when it comes to decompilation
(especially decompilation) and general security threats. Note that
Windows Update is updating components written in C++.

RAD is not productivity
"Barring use of Win32 API calls, VB6 was remarkably immune to all of
these problems. Makes you wonder who’s been writing the bad code,
doesn’t it?"
http://www.danappleman.com/index.php?p=4

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 21 '05 #6

P: n/a
Ken,

I explicitly wrote it as I did, Controlarray as in VB6 and array of controls
as used in VBNet.

http://msdn.microsoft.com/library/de...alBasicNET.asp

I explicitly wrote it that way to give no discussions with VB6 dyhards as
Jef who give me than this page. My text "whatever that is" was meant because
the VB6 controlarray is of course as well an array of controls.

Now I get a reply from another VB6 dyhard in the other way.

:-)

Cor
"Ken Halter"
..
Cor Ligthert wrote:
Kishan,

You cannot make a controlarray as in VB6 (whatever that is)


Hopefully, you're joking (you must be). VB6, aka VB.Cool, aka VB Classic
is the last release of Visual anything that actually used the Basic
language. It was the last release of a development tool that could
actually read/use code from previous versions up to and including 10+ year
old versions. In fact, most Basic code ran find in VB6. Even late 1970's
DOS basic with minor modifications.

No comparison to this new "throw my code away for each new release" B#

fwiw, VB Classic code's safer too when it comes to decompilation
(especially decompilation) and general security threats. Note that Windows
Update is updating components written in C++.

RAD is not productivity
"Barring use of Win32 API calls, VB6 was remarkably immune to all of these
problems. Makes you wonder who’s been writing the bad code, doesn’t it?"
http://www.danappleman.com/index.php?p=4

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.