Private Sub Command1_Click()
Dim sFile As String
CommonDialog1.Filter = "Text (*.txt) | *.txt"
CommonDialog1.CancelError = False
CommonDialog1.ShowOpen
sFile = CommonDialog1.FileName
If Len(sFile) > 0 Then
OpenFile List1, sFile
End If
End Sub
Private Sub Command3_Click()
Dim iCnt As Integer
Open "C:\list.txt" For Output As #1
For iCnt = 0 To List2.ListCount - 1
Print #1, List2.List(iCnt)
Next
Close #1
Shell "Notepad.exe C:\list.txt", vbNormalFocus
End Sub
Private Sub Command4_Click()
Timer1.Enabled = True
End Sub
Private Function OpenFile(lstBox As ListBox, FileName As String) As String
Dim FF As Integer
Dim sString As String
FF = FreeFile
Open FileName For Input As #FF
Do Until EOF(FF)
Line Input #FF, sString
If sString <> "" Then
lstBox.AddItem sString
End If
Loop
Close #FF
End Function
Private Sub Timer1_Timer()
While List1.ListCount > 0
List2.AddItem ("List1.AddItem (Text1.Text & "" & List1.Text & "")")
List1.RemoveItem (Selected)
List1.Selected (0)
Wend
End Sub