Tools Links Login

Post routine

Makes a multi-line textbox into a scrolling textbox, chat-style.

Usage

post frmLogging.text1, "Text to Post"

Side Effects

Constant MAXCHARS must be declared at the top of the module. Do not exceed 50000 for MAXCHARS.

Const MAXCHARS = 5000
Public Sub Post(tbxEditBox As TextBox, sNewText As String)
  sNewText = sNewText & vbCrLf
  With tbxEditBox
    If Len(sNewText) + Len(.Text) > MAXCHARS Then
      ''Scroll some text off the top to make more room
      .Text = Mid$(.Text, InStr(100 + Len(sNewText), .Text, vbCrLf) + 2)
    End If
    .SelStart = Len(.Text)
    .SelText = sNewText
  End With
  DoEvents
End Sub

About this post

Posted: 2008-03-03
By: FortyPoundHead
Viewed: 2,728 times

Categories

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.