vb 如何倒着读取记事本

大家好,记事本中有10000行数据,数据从1到10000.
假设现在停在500行,想倒着读取,也就是读499行,498行,等等。
然后,倒着读,也可以任意定位。此外,读到第一行要有提示。
请问如何才能做到?
仅剩8分!!!

'新建工程, 粘贴如下代码并运行即可
'如果要读取指定行, 请双击窗体
'关键就是 Split 按 vbCrlf 分割

Option Explicit

Dim s() As String, HasFile As Boolean

Private Function GetTxt(TxtPath As String) As String
On Error GoTo Wr
Dim i As Integer: i = FreeFile
Open TxtPath For Input As #i
GetTxt = StrConv(InputB(LOF(i), i), vbUnicode)
Close #i
Wr:
End Function

Private Sub Form_DblClick()
Dim r As String: Static i As Long
If HasFile = False Then Exit Sub
r = InputBox("请输入您要读取的行号!", "指定行读取", i)
If Len(r) Then
i = Int(Val(r))
If i >= 1 And i <= UBound(s) + 1 Then MsgBox s(i - 1), , "第" & i & "行" Else MsgBox "行号超出范围", 48, "错误"
End If
End Sub

Private Sub Form_Load()
Caption = "倒着读TXT文件"
AutoRedraw = True: OLEDropMode = 1
Print "请将要读的 Txt 文件拖动到窗口中"
ReDim s(0 To 0)
End Sub

Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim t As String, i As Long
If Data.GetFormat(15) Then
Cls
Print Data.Files(1): Print "开始读取..."
t = GetTxt(Data.Files(1))
If Len(t) = 0 Then HasFile = False: MsgBox "不能读空文件!", 48, "提示": Print "结束读取": Exit Sub
s = Split(t, vbCrLf): HasFile = True
Print "共有 "; UBound(s) + 1; " 行, 现在开始输出"
Print "行号", "内容"
For i = UBound(s) To 0 Step -1
Print i + 1, s(i)
Next
End If
End Sub
温馨提示:答案为网友推荐,仅供参考