control array

  • Thread starter Kishan Hathiwala
  • Start date
K

Kishan Hathiwala

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
 
S

Shiva

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/default.asp?url=/library/en-us/dv_vstechart/html/controlarrays.asp

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
 
C

Cor Ligthert

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" <[email protected]>
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
 
K

Kishan Hathiwala

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
 
C

Cor Ligthert

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" (e-mail address removed)

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
 
K

Ken Halter

Cor said:
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
 
C

Cor Ligthert

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/d.../vbconControlArrayChangesInVisualBasicNET.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"
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Winsock 6 control in VB.NET 6
vb.net and winsock 3
winsock in dotnet 5
Control Arrays 3
Convert VB6 ActiveX Control to VB.NET And Incorporate it Into ASPX 0
TCP Socket 3
TCP/IP Connections 3
control array 6

Top