I'm trying to get the number of pages notepad before print,

I'm setting the notepad to `wordwrap=true, FontSize=12, MarginRight=750, MarginLeft=750, MarginTop=1000, MarginBottom=1000,`

Greater than `70` is the number of column for page is equal to `1 and 51` is the number of line when page is equal to 1 also.

It's working But some mistakes on the formula I have, some notepad pages gets Ok, but some are not.

I hope someone could correct the code what I have.

Or is there any proper code to get this done even if notepad settings are changed, if there is no proper way of getting the notepad pages, at-least someone could correct the code I have.

Thanks.

```
Private Function GetNotepadNumPage(ByVal filename as string) as Integer    
Dim sr As New StreamReader(filename)
        Dim line As String = sr.ReadLine
        Dim CharL(9999) As Integer
        Dim pCount As Integer = 0
        Dim pLine As Integer = 0
        Do While Not sr.EndOfStream
            line = sr.ReadLine()
            CharL(pLine) = line.Length
            pLine += 1
            If pLine = 51 Then
                pCount += 1
                For i As Integer = 0 To pLine
                    If CharL(i) > 70 Then
                        pCount += 1
                        Exit For
                    End If
                Next
                pLine = 0
            End If
        Loop
        sr.Close()

        If (pLine <> 0) Then
            pCount += 1
            For i As Integer = 0 To pLine
                If CharL(i) > 70 Then
                    pCount += 1
                    Exit For
                End If
            Next
        End If

        pagecount = pCount
Return pagecount
End Function

```