Results 1 to 3 of 3

Thread: For each label in me.controls

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    11

    Question For each label in me.controls

    Is there anyway to have a for each statement that gets all of the labels in the form except for a few?
    example i have
    dim x as label
    for each x in me.controls
    x.tag = randomnumber
    next

    i want to get every label except for 2 of them (name1 and name2)
    thanks for your help

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    11

    Re: For each label in me.controls

    nevermind, i figured it out :P

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: For each label in me.controls

    vb Code:
    1. For Each lbl As Label In Me.Controls.OfType(Of Label).Except(New Label() {name1, name2})
    2.     lbl.Tag = randomnumber
    3. Next

Tags for this Thread

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