Results 1 to 3 of 3

Thread: Form Feeds

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Galloway, OH, US
    Posts
    13

    Post

    I am developing a program that has a text box that displays a report. The user is supposed to see one page of the report at a time and has a "Next Page" and "Previous Page" command button to see additional pages. I have the code to display the whole report but I need to write the code to search for ASCII Chr$12 and display the text from one form feed to another. HELPPPPP!!!!

  2. #2
    Lively Member
    Join Date
    Aug 1999
    Location
    SLOVENIA, Europe
    Posts
    110

    Post

    I'm not shure that I understand.

    To detect ascii char 12 then this code mus help:

    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 12 Then
    ' you code goes here
    End If
    End Sub

    Ermin

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    ermingut's code will detect the manual entry of a line feed. Here is code to print page by page which is what I think you want to do.
    Code:
    Dim sMyText As String
    Dim intLFPos As Integer
    
    sMyText = "12345" & Chr(12) & "67890" & Chr(12) & "abcdefg"
    
    intLFPos = 999
    
    Do While intLFPos > 0
        ' Use InStr to find the first line feed
        intLFPos = InStr(1, sMyText, Chr(12))
        If intLFPos > 0 Then
            ' We've found a line feed so first print the text
            ' up to the line feed character...
            Debug.Print Left$(sMyText, intLFPos - 1)
            '... and then remove that portion and the line feed
            ' from the text
            sMyText = Right$(sMyText, Len(sMyText) - intLFPos)
        Else
            ' There are no more line feeds, so just print the tail end.
            Debug.Print sMyText
        End If
    Loop
    Change the Debug.Print lines to whatever you do to print the pages, and ignore the sMyText = "12345" & Chr(12) & "67890" & Chr(12) & "abcdefg"
    line which is obviously test data.

    ------------------
    Marty

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