Hi,

>      As to my current question, what I am running into is 
> limitations displaying text on the screen.  I usually use a 
> textbox to show progress reports, etc, and I noticed after so 
> far is just quits displaying new text.  I am assuming this is 
> due to a size limitation for textboxes.  Is there a way 
> around this?  What if I want to stream text to the screen 
> infinitely, how can I do that?  What if I wanted a program to 
> operate in "old style" 80 columns, and just "print" text to 
> the screen all day.  How could I create a "10 print "hi", 20 
> goto 10" type program in VB?

Forgive me if I am suggesting anything that you have already thought of...

Something that I do to make things easier for myself is to define a global
function called "LogText" that takes one parameter - the text to be logged
for an individual event/error/whatever.

Because all logging is done through the one location, it is easy to make the
run-time behaviour different from design-time/debugging behaviour.

It is usually a good idea to write all of the information to a file, and to
display only the most recent 100 (or 200 or whatever) logged items on the
screen.

To answer your original question, here is an example (without the file
logging that I would normally do):

Public Sub LogText(ByVal sText As String)
    Const lcMaxRecentLogEntries As Long = 100
    Const lcSeparator As String = vbCrLf
    Static sRecentLogEntries As String
    Static lNumRecentLogEntries As Long
    Dim lPos As Long
    
    'Ensure that the separator does not occur within the text being logged.
    sText = Replace$(sText, lcSeparator, " ")
    
    lNumRecentLogEntries = lNumRecentLogEntries + 1
    If lNumRecentLogEntries > lcMaxRecentLogEntries Then
        lNumRecentLogEntries = lcMaxRecentLogEntries
        lPos = InStr(sRecentLogEntries, lcSeparator)
        sRecentLogEntries = Right$(sRecentLogEntries, Len(sRecentLogEntries)
- lPos - Len(lcSeparator))
    End If
    
    sRecentLogEntries = sRecentLogEntries & sText & lcSeparator
    frmLogging.Text1.Text = sRecentLogEntries
End Sub



HTH.

Adelle.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to