写到Ñ次都是显是前4笔...
程序代码:
Option Explicit Dim FN As String Private Sub Command1_Click() If Text5.Text <> "" Then Call outputData Text5.Text = "" End If End Sub Private Sub outputData() Dim FileNum As Integer FileNum = FreeFile Open FN For Append As #FileNum Print #FileNum, Text5.Text Close #FileNum End Sub Private Function IsFileExist(strFileName As String) As Boolean Dim varFSO As Variant Set varFSO = CreateObject("Scripting.FileSystemObject") IsFileExist = varFSO.FileExists(strFileName) Set varFSO = Nothing End Function Private Sub Form_Initialize() FN = App.Path & "\my.txt" End Sub Private Sub Form_Load() If IsFileExist(FN) = True Then Call LoadData End If Frame1.Enabled = False End Sub Private Sub LoadData() Dim FileNum As Integer, i As Integer Dim Temp As String FileNum = FreeFile Open FN For Input As #FileNum Do While Not EOF(FileNum) Line Input #FileNum, Temp If Temp <> "" Then List1.AddItem Temp, i i = i + 1 End If Loop Close #FileNum For i = 0 To 3 If i = 0 Then Text1.Text = "First:" & List1.List(i) End If If i = 1 Then Text2.Text = "Second:" & List1.List(i) End If If i = 2 Then Text3.Text = "Third:" & List1.List(i) End If If i = 3 Then Text4.Text = "Fourth:" & List1.List(i) End If Next i End Sub
不要投我