inet控制Inet1.Execute "http://www......com/1.txt","Get" while Inet1.StillExecuting:doevents:wend dim A as string A=inet1.getchunk(8192,0) text1.text=a然后根据text1.text中的内容来设置如何让listbox显示
有没有什么方法可以不用控件?api函数
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long Private Sub Command1_Click() URLDownloadToFile 0, "http://www.yzmet.gov.cn/VB1/article/chinese/other/36.txt", App.Path & "\temp.txt", 0, 0 Dim b() As Byte, x() As String, temp As String Open App.Path & "\temp.txt" For Binary As #1 ReDim b(LOF(1)) Get #1, , b Close #1 x = Split(StrConv(b, vbUnicode), vbCrLf) Erase b For i = 0 To UBound(x) List1.AddItem x(i) Next Erase x Kill App.Path & "\temp.txt" End Sub
while Inet1.StillExecuting:doevents:wend
dim A as string
A=inet1.getchunk(8192,0)
text1.text=a然后根据text1.text中的内容来设置如何让listbox显示
Private Sub Command1_Click()
URLDownloadToFile 0, "http://www.yzmet.gov.cn/VB1/article/chinese/other/36.txt", App.Path & "\temp.txt", 0, 0
Dim b() As Byte, x() As String, temp As String
Open App.Path & "\temp.txt" For Binary As #1
ReDim b(LOF(1))
Get #1, , b
Close #1
x = Split(StrConv(b, vbUnicode), vbCrLf)
Erase b
For i = 0 To UBound(x)
List1.AddItem x(i)
Next
Erase x
Kill App.Path & "\temp.txt"
End Sub