🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.basic.visual.3rdparty
2 messages
2 total messages Started by Bobby Hicks Tue, 24 Jul 2001 22:00
Reading Data from an RTB
#12
Author: Bobby Hicks
Date: Tue, 24 Jul 2001 22:00
71 lines
3566 bytes
Hello everyone.
    What I 'm trying to do is read in one word, one number(of any length.
2,3,4+characters long), one character.
I kind of have the one character down, but the one word and one number is
baffling me.
I 'm using an RTB to store the information from the file, and at the end of
each line, there's the lf/cr codes(10/13 respectively).

I know there "has" to be a simpler way of doing this. I've tried Mid/Instr,
but I can't get anywhere with it cuz the RTB is multilined.

Any help would be greatly appreciated.

TIA,
Bobby


Here are my functions:
Function fread_word(StartPos As Integer, strReturn As String)
    Dim strTemp As String
    strReturn = ""
    rtfText.SelStart = StartPos
    rtfText.SelLength = 1
    If Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13 Then
        Do While Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13
            StartPos = StartPos + 1
            rtfText.SelStart = StartPos
            rtfText.SelLength = 1
        Loop
    End If
    Do While Not rtfText.SelText = " "
        strReturn = strReturn & rtfText.SelText
        StartPos = StartPos + 1
        rtfText.SelStart = StartPos
        rtfText.SelLength = 1
    Loop
    If rtfText.SelText = " " Then
        StartPos = StartPos + 1
    End If
End Function

Function fread_char(StartPos As Integer, strReturn As String)

    rtfText.SelStart = StartPos
    rtfText.SelLength = 1
    Do While Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13
        StartPos = StartPos + 1
        rtfText.SelStart = StartPos
        rtfText.SelLength = 1
    Loop
    rtfText.SelStart = StartPos
    rtfText.SelLength = 1
    strReturn = rtfText.SelText
    StartPos = StartPos + 1
End Function

Function fread_number(StartPos As Integer, intReturn As Integer)
    Dim FindEndPos As Integer
    Dim strTemp As String
    Call fread_char(StartPos, strTemp)
    FindEndPos = StartPos + 1
    rtfText.SelStart = StartPos
    rtfText.SelLength = 1
    Do While IsNumeric(strTemp)
        Call fread_char(StartPos, strTemp)
        If IsNumeric(strTemp) Then
            intReturn = intReturn & Str(strTemp)
        End If
    Loop
'    StartPos = StartPos - 1
End Function
Re: Reading Data from an RTB
#13
Author: James Roberts
Date: Thu, 26 Jul 2001 00:25
84 lines
3895 bytes
Does it need to be loaded into a Rich Text Box?  Put it into a string then
mid$ etc will work. The less you let things get in your way the better off
you are. Look for examples of gettoken etc for hints on how to read.

jr


"Bobby Hicks" <b_hicks@alltel.net> wrote in message
news:9jkr93$3n1$1@iac5.navix.net...
> Hello everyone.
>     What I 'm trying to do is read in one word, one number(of any length.
> 2,3,4+characters long), one character.
> I kind of have the one character down, but the one word and one number is
> baffling me.
> I 'm using an RTB to store the information from the file, and at the end
of
> each line, there's the lf/cr codes(10/13 respectively).
>
> I know there "has" to be a simpler way of doing this. I've tried
Mid/Instr,
> but I can't get anywhere with it cuz the RTB is multilined.
>
> Any help would be greatly appreciated.
>
> TIA,
> Bobby
>
>
> Here are my functions:
> Function fread_word(StartPos As Integer, strReturn As String)
>     Dim strTemp As String
>     strReturn = ""
>     rtfText.SelStart = StartPos
>     rtfText.SelLength = 1
>     If Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13 Then
>         Do While Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13
>             StartPos = StartPos + 1
>             rtfText.SelStart = StartPos
>             rtfText.SelLength = 1
>         Loop
>     End If
>     Do While Not rtfText.SelText = " "
>         strReturn = strReturn & rtfText.SelText
>         StartPos = StartPos + 1
>         rtfText.SelStart = StartPos
>         rtfText.SelLength = 1
>     Loop
>     If rtfText.SelText = " " Then
>         StartPos = StartPos + 1
>     End If
> End Function
>
> Function fread_char(StartPos As Integer, strReturn As String)
>
>     rtfText.SelStart = StartPos
>     rtfText.SelLength = 1
>     Do While Asc(rtfText.SelText) = 10 Or Asc(rtfText.SelText) = 13
>         StartPos = StartPos + 1
>         rtfText.SelStart = StartPos
>         rtfText.SelLength = 1
>     Loop
>     rtfText.SelStart = StartPos
>     rtfText.SelLength = 1
>     strReturn = rtfText.SelText
>     StartPos = StartPos + 1
> End Function
>
> Function fread_number(StartPos As Integer, intReturn As Integer)
>     Dim FindEndPos As Integer
>     Dim strTemp As String
>     Call fread_char(StartPos, strTemp)
>     FindEndPos = StartPos + 1
>     rtfText.SelStart = StartPos
>     rtfText.SelLength = 1
>     Do While IsNumeric(strTemp)
>         Call fread_char(StartPos, strTemp)
>         If IsNumeric(strTemp) Then
>             intReturn = intReturn & Str(strTemp)
>         End If
>     Loop
> '    StartPos = StartPos - 1
> End Function
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads