Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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...

Posted (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 by Ariez

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

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...

Posted (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 by Ariez

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...