Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help using control collection

Help using control collection

Scheduled Pinned Locked Moved Visual Basic
helptutorial
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Magno R Vasquez
    wrote on last edited by
    #1

    i am making a function that validate control using for each controlname in me.control...next where "me" is the name of the actual form using this i can validate my controls but not with the order tab that the controls have it, the control collection is taking the last control for biginin to validate. And the other problen is that i have a control different of controlname used in de for statement for example a command button, it give me a error becose is validating it... i need some help please!!!:)

    Gbyte

    H 1 Reply Last reply
    0
    • M Magno R Vasquez

      i am making a function that validate control using for each controlname in me.control...next where "me" is the name of the actual form using this i can validate my controls but not with the order tab that the controls have it, the control collection is taking the last control for biginin to validate. And the other problen is that i have a control different of controlname used in de for statement for example a command button, it give me a error becose is validating it... i need some help please!!!:)

      Gbyte

      H Offline
      H Offline
      hollywood_t
      wrote on last edited by
      #2

      I have the same problem. My form has over 100 controls. I would like to loop throught the controls in a particular order. Is this possible? I can loop through the controls using [ me.Controls(i) ] but the default collection does not contain the controls in the order I require. This was easy using the index property in previous versions. eg Loop through Label_01 to Label_23 then Label_45 to label_62. I could do this using a Case statement but think that this is not good style and may slow the application. If you can help I would be thankful. Hollywood_t

      H 1 Reply Last reply
      0
      • H hollywood_t

        I have the same problem. My form has over 100 controls. I would like to loop throught the controls in a particular order. Is this possible? I can loop through the controls using [ me.Controls(i) ] but the default collection does not contain the controls in the order I require. This was easy using the index property in previous versions. eg Loop through Label_01 to Label_23 then Label_45 to label_62. I could do this using a Case statement but think that this is not good style and may slow the application. If you can help I would be thankful. Hollywood_t

        H Offline
        H Offline
        hollywood_t
        wrote on last edited by
        #3

        ' Run once after the form is loaded and conrtols are created Dim slControls as SortedList Dim i as Integer for i - 0 to me.controls.count - 1 'You may include a CASE or IF statement if you want to selectively add slControls.add(me.controls(i).name, i) next 'In your event handler for each control that changes 'that is of interest to you write sub routines for adding, removing 'sorting, etc..... '*include appropriate code to filter those controls you need 'slControls.Remove(me.controls(i).name) 'slControls.Add(me.controls(i).name, Index) 'To retrieve a control's info simply loop through the array for i = 0 to slControls.count - 1 slControls.GetKey(i) ' Returns the key - in this example's case - the NAME slControls.GetbyIndex(i) ' Returns the value - in this example's case - the Order in the Collection ' Do your validation here using the values returned from the array slControls next '*** NB - code has been typed - please check for errors *** Hollywood_t

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups