乡村风月txt下载百:VB 题目不懂。帮忙!

来源:百度文库 编辑:高校问答 时间:2024/04/24 11:23:28
Private Sub Combo1_Click()
Label1.Font.Size = Combo1.Text

End Sub

Private Sub Combo2_Change()
Label1.Font.Name = Combo1.Text
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim i As Long, j As Long
Open "out4.txt" For Output As #1
For i = 0 To Combo1.ListCount - 1
Combo1.ListIndex = i
For j = 0 To Combo2.ListCount - 1
Combo2.ListIndex = j
Print #1, Combo1.Text & Combo2.Text & CInt(Label1.Font.Size) & Label.Font
Next j
Next i
Close #1
End Sub

最后一个事件没看懂什么意思,帮忙解释一下哦!

卸载窗体时,对Combo1进行遍历,并对Combo2进行嵌套遍历,不过我看这程序的循环嵌套是不是没写好,为什么要写一个Combo1之后把Combo2都写进去,然后再写一个Combo1,又把Combo2都写进去.

我推测一下,是不是应该是这样的呢:
Private Sub Form_Unload(Cancel As Integer)
Dim i As Long

static j As Long

Open "out4.txt" For Output As #1
For i = 0 To Combo1.ListCount - 1
Combo1.ListIndex = i
Combo2.ListIndex = i
Print #1, Combo1.Text & Combo2.Text & CInt(Label1.Font.Size) & Label.Font
Next i
Close #1
End Sub

为当前窗体卸载时对out4.txt文本文件进行写操作。

窗体卸载的时候触发
详细可以到这里学习