Results 1 to 2 of 2

Thread: [RESOLVED] label caption

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    98

    Resolved [RESOLVED] label caption

    is there any way if the caption do not change for specific time then a command is called.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: label caption

    Would something like this work for you?
    To run this sample you will need Label control, Command Button and Timer.
    Code:
    Option Explicit
    
    Dim myCounter As Integer
    Dim myInterval As Long
    Dim myCaption As String
    
    Private Sub Form_Load()
        Label1.Caption = "Hello World!"
        myInterval = 5 '5 seconds
        myCaption = Label1.Caption
        Timer1.Interval = 1000 '1 second
        Timer1.Enabled = True
    End Sub
    
    Private Sub Command1_Click()
        Label1.Caption = IIf(Label1.Caption = "Hello World!", "Goodbye World!", "Hello World!")
        myCaption = Label1.Caption
        myCounter = 0
    End Sub
    
    Private Sub Timer1_Timer()
        myCounter = myCounter + 1
        If myCounter = myInterval Then
            If Label1.Caption = myCaption Then
                Test
            End If
            myCounter = 0
        End If
    End Sub
    
    Public Sub Test()
        MsgBox "Hey, change your label's caption!"
    End Sub

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