vb运行了一段程序后就无法响应了,程序的内容主要是有一个随机文件,两个列表菜单,点击确定后从随机文件中找到符合两个列表菜单的记录,然后在几个label中显示各个字段中的记录,点击label的字体会变成粗体,然后把label的aption赋给全局变量,点击选择会显示到另一个form,在这个form中在label中显示上一个form所赋值的全局变量(很乱)
现在的问题是如果在开始选择的是文件中的第一条记录就可以正常运行,而选择其他的记录点击选择后会出现无法响应,是什么原因啊,各位帮帮忙找找啊第一个form的部分代码Private Sub Command1_Click()
Dim ainfo As airinfo
Dim F As Integer
Dim i As Integer
Dim j As Integer
Dim l As Integer
F = FreeFile
i = 1
j = 1
For l = 1 To Label1.Count - 1
Unload Label1(l)
Unload Label2(l)
Unload Label3(l)
Unload Label4(l)
Unload Label5(l)
Unload Label6(l)
Unload Label7(l)
Unload Label8(l)
NextOpen App.Path & "\data\airinfo.dat" For Random As #F Len = Len(ainfo)
Do Until EOF(F)
Get #F, i, ainfo
If Combo1.Text = Trim(Replace(ainfo.cfd, Chr(0), "")) And Combo2.Text = Trim(Replace(ainfo.mdd, Chr(0), "")) Then
Load Label1(j)
Label1(j).Top = Label1(0).Top + (j) * 500
Label1(j).Visible = True
Label1(j).Caption = Trim(Replace(ainfo.id, Chr(0), ""))Load Label2(j)
Label2(j).Top = Label2(0).Top + (j) * 500
Label2(j).Visible = True
Label2(j).Caption = Trim(Replace(ainfo.cfd, Chr(0), ""))Load Label3(j)
Label3(j).Top = Label3(0).Top + (j) * 500
Label3(j).Visible = True
Label3(j).Caption = Trim(Replace(ainfo.mdd, Chr(0), ""))Load Label4(j)
Label4(j).Top = Label4(0).Top + (j) * 500
Label4(j).Visible = True
Label4(j).Caption = Format(ainfo.cftime, "yyyy-mm-dd hh:mm")Load Label5(j)
Label5(j).Top = Label5(0).Top + (j) * 500
Label5(j).Visible = True
Label5(j).Caption = Format(ainfo.ddtime, "yyyy-mm-dd hh:mm")Load Label6(j)
Label6(j).Top = Label6(0).Top + (j) * 500
Label6(j).Visible = True
Label6(j).Caption = Trim(Replace(ainfo.yongshi, Chr(0), ""))Load Label7(j)
Label7(j).Top = Label7(0).Top + (j) * 500
Label7(j).Visible = True
Label7(j).Caption = Trim(Replace(ainfo.leixing, Chr(0), ""))Load Label8(j)
Label8(j).Top = Label8(0).Top + (j) * 500
Label8(j).Visible = True
Label8(j).Caption = ainfo.zuowei & "/" & ainfo.zuoweij = j + 1
End If
i = i + 1
Loop
Close #F
End SubPrivate Sub Command2_Click()
Form5.Show
End SubPrivate Sub Label1_Click(Index As Integer)
Dim i As Integer
Cls
For i = 1 To Label1.Count - 1
Label1(i).FontBold = False
Label2(i).FontBold = False
Label3(i).FontBold = False
Label4(i).FontBold = False
Label5(i).FontBold = False
Label6(i).FontBold = False
Label7(i).FontBold = False
Label8(i).FontBold = False
Next
Label1(Index).FontBold = True
Label2(Index).FontBold = True
Label3(Index).FontBold = True
Label4(Index).FontBold = True
Label5(Index).FontBold = True
Label6(Index).FontBold = True
Label7(Index).FontBold = True
Label8(Index).FontBold = True
idyes = Label1(Index).Caption
cfdyes = Label2(Index).Caption
mddyes = Label3(Index).Caption
cftimeyes = Label4(Index).Caption
ddtimeyes = Label5(Index).Caption
yongshiyes = Label6(Index).Caption
leixingyes = Label7(Index).Caption
zuoweiyes = Label8(Index).Caption
End Sub