hys Posted April 10, 2003 Posted April 10, 2003 Hello all, Just a quick question ... I used to be able to use indexs in VB 6 to dynamically recreate and item ... but there are no indexs in VB.NET help !!! say i have a winsock control .. named ... wSck ... how do i get wSck(0) and wSck(1) and so on... Quote
Ariez Posted April 10, 2003 Posted April 10, 2003 (edited) You can still declare dim wSck(Nbr) as YourClass but you'll have to create an instance before using each wSck(i)=new YourClass() So you don't have indexing at design for windows form controls too but you can achieve the same: dim myTextBoxes(nbr) as textbox for i =0 to nbr-1 myTextBoxes(i) = New Textbox() With myTextBoxes(i) .height= .width= .top= addhandler... End With next Edited April 10, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
hys Posted April 10, 2003 Author Posted April 10, 2003 but how do i replicate a control that is already on the form at the moment i have a winsock control on the form, with the defaulted parameters... therefore i would like to make two instances of the control... Quote
Ariez Posted April 11, 2003 Posted April 11, 2003 (edited) to my knowledge, the best way to replicate a control by creating a new instance of it and have some init proc set its parameters. wSck(i)=myExistingwSck wouldnt work. They are many ways to achieve this. Create an inherited class and have its constructor do the job.Then add a new instance to an arraylist, create an array of them,... your choice....... OR Do as i mentionned earlier if you have to create an array once or..Or..or....there are probably as many ways as programmers.. Edited April 11, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
*Gurus* divil Posted April 11, 2003 *Gurus* Posted April 11, 2003 It's worth mentioning that if this is the old VB6 Winsock control you're talking about, you really shouldn't be using it in .NET - That's what the Socket and TcpClient classes are for. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
hys Posted April 13, 2003 Author Posted April 13, 2003 so how do u use this Socket and TcpClient Quote
*Gurus* divil Posted April 13, 2003 *Gurus* Posted April 13, 2003 Read the docs and Google for samples online :) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.