7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub AddList()
Dim i As Integer, s As String
s = LCase(Combo1.Text)
For i = 0 To Combo1.ListCount - 1
If LCase(Combo1.List(i)) = s Then _
Exit Sub
Next i
Combo1.AddItem Combo1.Text
'*写入到txt
Dim FSO As Object
Dim FSO_File As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(App.Path & "/111.txt", ForWriting, True)
Dim y As Long
For y = 0 To Me.Combo1.ListCount - 1
FSO_File.WriteLine Me.Combo1.List(y)
Next
FSO_File.Close
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call AddList
End Sub
Private Sub Command1_Click()
'*txt导入
Dim FSO As Object
Dim FSO_File As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(App.Path & "/111.txt", ForReading, False)
Do While Not FSO_File.AtEndOfStream
Me.Combo1.AddItem FSO_File.ReadLine
Loop
FSO_File.Close
End Sub
Private Sub AddList()
Dim i As Integer, s As String
s = LCase(Combo1.Text)
For i = 0 To Combo1.ListCount - 1
If LCase(Combo1.List(i)) = s Then _
Exit Sub
Next i
Combo1.AddItem Combo1.Text
'*写入到txt
Dim FSO As Object
Dim FSO_File As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(App.Path & "/111.txt", ForWriting, True)
Dim y As Long
For y = 0 To Me.Combo1.ListCount - 1
FSO_File.WriteLine Me.Combo1.List(y)
Next
FSO_File.Close
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call AddList
End Sub
Private Sub Command1_Click()
Call AddList
End Sub
Private Sub Form_Load()
'*txt导入
Dim FSO As Object
Dim FSO_File As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FSO_File = FSO.OpenTextFile(App.Path & "/111.txt", ForReading, False)
Do While Not FSO_File.AtEndOfStream
Me.Combo1.AddItem FSO_File.ReadLine
Loop
FSO_File.Close
End Sub