Results 1 to 3 of 3

Thread: {Loop through controls of a control array}-URGENT

  1. #1

    Thread Starter
    Addicted Member prophecy's Avatar
    Join Date
    Mar 2005
    Location
    In the developers list of Visual Basic ;-)
    Posts
    242

    Talking {Loop through controls of a control array}-URGENT

    hi..

    i have a winsock control array with index's say 0,1,4,6,etc...
    i want to knw how to loop through all the control arrays of dat control...
    pls help!
    Got You! - ©
    - My Signature.
    Visit www.compzone.hhnf.com. If you think i helped you, add to my reputation by Clicking "Rate This Post".

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: {Loop through controls of a control array}-URGENT

    Quote Originally Posted by prophecy
    hi..

    i have a winsock control array with index's say 0,1,4,6,etc...
    i want to knw how to loop through all the control arrays of dat control...
    pls help!
    Are the indexes in sequence? I.O.W. Sequentially from 0 to 6?

    If that is the case you could use a For loop
    VB Code:
    1. Dim I As Integer
    2. For I = 0 To 6
    3. 'do whatever
    4. Next I
    VB.NET MVP 2008 - Present

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: {Loop through controls of a control array}-URGENT

    You can do it like this.
    VB Code:
    1. Private Sub Command1_Click()
    2.     For Each cont In Controls
    3.         If cont.Name = "WinsockX" Then  '<-- Replace with your control name
    4.             ''whatever you want to do
    5.             MsgBox cont.Name & cont.Index
    6.         End If
    7.     Next
    8. End Sub
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width