how do we create form caption [form title bar] effetcs like typing words.

Recommended Answers

All 3 Replies

What exactly you are trying to do ?

If you are trying to make the title of a form appear as though someone has typed it in, then the easiest way would be to use a timer that will update the caption with one letter on each run.

I'd say keep a module based integer variable which will hold the marker in the title. Maybe (for ease), have a module based string variable too which will hold the expected caption.

Then the timer should have code in it which would find the "MID" value of the caption string based on the position by the marker. Then increment the marker by one so it's ready for the next run.

Something along the lines of this.

Private m_iMarker As Integer
Private m_sCaption As String

Private Sub Command1_Click()
    Me.Caption = vbNullString
    m_sCaption = "Caption typing effect by jonifen"
    m_iMarker = 1
    tmrCaption.Interval = 400
    tmrCaption.Enabled = True
End Sub

Private Sub tmrCaption_Timer()
    If Len(Me.Caption) = 0 Then
        Me.Caption = Left$(m_sCaption, 1)
    Else
        Me.Caption = Me.Caption & Mid$(m_sCaption, m_iMarker, 1)
    End If
    
    m_iMarker = m_iMarker + 1
End Sub

If you want to add the caption as you type, use it in a text box change event. -

Private Sub Text1_Change()

Me.Caption = Text1.Text
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.