Results 1 to 4 of 4

Thread: How do I identify the first empty label in a set of labels?

  1. #1

    Thread Starter
    Lively Member flint's Avatar
    Join Date
    Oct 2000
    Posts
    67
    I need to know how to find the first "empty" caption property of several labels.

    Here's the scenario:
    I have two different types of products, therefore I made two seperate forms to identify all the products needed (put on frm2 & frm3) > frm4 compiles the products onto one form I would like to find the first "empty" row to insert the product > Any suggestions / methodologies?

    Flint

    People think we make $3 million and $4 million a year. They don't realize that most of us only make $500,000.
    Pete Incaviglia, baseball player, 1990

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Cool

    Try this

    Dim lbl As Label
    For Each lbl in Form1
    If lbl.Caption = vbNullstring Then
    ' Do something to the blank caption
    end if
    Next lbl
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3

    Thread Starter
    Lively Member flint's Avatar
    Join Date
    Oct 2000
    Posts
    67
    Thanx Jerry.

    I'll give it a whirl...I don't want to do this for every label string on the form, just a select few. I'll work with it and see what happens.

    Flint

    Imagination was given to man to compensate him for what he is not; a sense of humor to console him for what he is.
    - Francis Bacon

  4. #4
    Guest
    There are some errors in his code. Try the following instead.
    Code:
    Dim lbl As Control
    
    For Each lbl In Controls
        If lbl.Caption = "" Then
            ' Do something to the blank caption
        End If
    Next lbl

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