PDA

Click to See Complete Forum and Search --> : Form Feeds


mgifford
Jan 19th, 2000, 12:20 AM
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!!!!

ermingut
Jan 19th, 2000, 12:29 AM
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

MartinLiss
Jan 19th, 2000, 01:17 AM
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.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