Results 1 to 2 of 2

Thread: simple bit of code , can't get it to work / clearing label captions

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    UK
    Posts
    300
    Hi

    I am trying to clear all the label captions from a form at the same time, I have tried to use this bit of code to clear all textboxes and adapted it to labels but it won't work. How do I do it ?

    Private Sub Command2_Click()

    Dim indx As Integer

    With Me.Controls
    MsgBox .Count
    For indx = 0 To .Count - 1
    If Me.Controls(indx).Tag = "1" Then
    If (TypeOf Me.Controls(indx) Is Label) Then
    Me.Controls(indx).Caption = " "
    End If
    End If
    Next
    End With
    DoEvents

    End Sub


    Thanx
    Locutus
    Resistance is futile

  2. #2
    Guest
    Try:

    Code:
      For Each MyControl In Me.Controls
          If TypeOf MyControl Is Label Then MyControl.Caption = ""
      Next

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