
展开全部
dim findex as integer '//全局变量,当前行ID
dim tmpstr() as string '//存放每条内容的数组
private sub form_load()
dim tmptxt as string
open yourfile for Input As #1
tmpTxt = StrConv(InputB(LOF(1), #1), vbUnicode)
close #1
tmpstr = Split(tmpTxt, vbCrLf) '//按行分别读入数组
text1=tmpstr(0)
end sub
private sub command1_click() '//上一条
if findex=0 then
msgbox "已经是第一行"
exit sub
end if
findex=findex-1
text1=tmpstr(findex)
end sub
private sub command2_click() '//下一条
if findex=ubound(tmpstr) then
msgbox "已经是最后一行"
exit sub
end if
findex=findex+
text1=tmpstr(findex)
end sub
dim tmpstr() as string '//存放每条内容的数组
private sub form_load()
dim tmptxt as string
open yourfile for Input As #1
tmpTxt = StrConv(InputB(LOF(1), #1), vbUnicode)
close #1
tmpstr = Split(tmpTxt, vbCrLf) '//按行分别读入数组
text1=tmpstr(0)
end sub
private sub command1_click() '//上一条
if findex=0 then
msgbox "已经是第一行"
exit sub
end if
findex=findex-1
text1=tmpstr(findex)
end sub
private sub command2_click() '//下一条
if findex=ubound(tmpstr) then
msgbox "已经是最后一行"
exit sub
end if
findex=findex+
text1=tmpstr(findex)
end sub
追问
If findex = UBound(tmpstr) Then
显示下标越界
追答
findex=findex+1 '//后面少写了个1
text1=tmpstr(findex)
展开全部
Dim i%, l%, s$
Private Sub Command1_Click() '上一条
If i <= 1 Then Exit Sub
i = i - 1
Open "c:\1.txt" For Input As #1
For l = 1 To i
On Error GoTo gamover
Line Input #1, s
Next
Text1.Text = s
gamover:
Close #1
End Sub
Private Sub Command2_Click() '下一条
i = i + 1
Open "c:\1.txt" For Input As #1
For l = 1 To i
On Error GoTo gamover
Line Input #1, s
Next
Text1.Text = s
gamover:
Close #1
End Sub
Private Sub Form_Load()
Open "g:\1.txt" For Input As #1
Line Input #1, s
Close #1
Text1.Text = s
i = 1
End Sub
Private Sub Command1_Click() '上一条
If i <= 1 Then Exit Sub
i = i - 1
Open "c:\1.txt" For Input As #1
For l = 1 To i
On Error GoTo gamover
Line Input #1, s
Next
Text1.Text = s
gamover:
Close #1
End Sub
Private Sub Command2_Click() '下一条
i = i + 1
Open "c:\1.txt" For Input As #1
For l = 1 To i
On Error GoTo gamover
Line Input #1, s
Next
Text1.Text = s
gamover:
Close #1
End Sub
Private Sub Form_Load()
Open "g:\1.txt" For Input As #1
Line Input #1, s
Close #1
Text1.Text = s
i = 1
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim a() As String
Dim n As Integer
Private Sub Command1_Click()
If n > 0 Then
n = n - 1
Text1.Text = a(n)
End If
End Sub
Private Sub Command2_Click()
If n < UBound(a) Then
n = n + 1
Text1.Text = a(n)
End If
End Sub
Private Sub Form_Load()
Open "c:\1.txt" For Input As #1
Do While Not EOF(1)
ReDim Preserve a(n)
Line Input #1, a(n)
n = n + 1
Loop
Close #1
n = 0
Text1.Text = a(0)
End Sub
Dim n As Integer
Private Sub Command1_Click()
If n > 0 Then
n = n - 1
Text1.Text = a(n)
End If
End Sub
Private Sub Command2_Click()
If n < UBound(a) Then
n = n + 1
Text1.Text = a(n)
End If
End Sub
Private Sub Form_Load()
Open "c:\1.txt" For Input As #1
Do While Not EOF(1)
ReDim Preserve a(n)
Line Input #1, a(n)
n = n + 1
Loop
Close #1
n = 0
Text1.Text = a(0)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询