How do i download a file to the c drive using vb?
Printable View
How do i download a file to the c drive using vb?
Also, how do i perform an action based on whats selected in a list box?
I'm a new guy so I hope this is helpful.
As to the 2nd question:
I think you want to look at the ListIndex property and use it to control the flow of your application, e.g., assuming a list and a button where the trigger is the button and the list is the modifier, you might have the following:
Hope it helps.Code:
Private Sub Command1_Click()
Select Case List1.ListIndex
Case 0
MsgBox "Item 1"
Case 1
MsgBox "Item 2"
Case 2
MsgBox "Item 3"
End Select
End Sub
Private Sub Form_Load()
List1.AddItem "First"
List1.AddItem "Second"
List1.AddItem "Third"
End Sub
Regards
NEW2VB
for downloading files, you can take a look at the tutorial in vb world for using the inet control...
as for performing an action, you can use List1.ListIndex to retrieve the number of the item that was selected, or use List1.List(List1.ListIndex) to get the string that was selected in the listbox
Code:Private Sub Command1_Click()
Dim F As Form
Select Case List1.Text
Case "Hello"
frmHello.Show
Case "About"
frmAbout.Show
Case "End"
For Each F In Forms
Unload F
Next F
End Select
End Sub
I couldnt find that demo, could someone just explain it to me.
Try one of these:
Try the execute command.
or download pictures or files with the Inet control.Code:Inet1.Execute "http://www.somewhere.com/index.html", "GET"
Hope that helps.Code:Dim iFile As Integer
Dim bBIN As Byte
Inet1.Cancel ' Stops any current operations
Inet1.AccessType = icUseDefault
Caption = "Downloading.."
bBIN = Inet1.OpenURL("www.vb-world.net/images/vbworld.gif", icByteArray)
iFile = FreeFile
Open "C:\vbworld.gif" For Binary Access Write As iFile
Put #iFile, , bBIN
Close iFile
Caption = "Download Complete."
Dear Matthew Gates,
I can't get the code running. Some objects are not understood.
Please can you references?
Thanks a lot.
Michelle.
Make sure you added the iNET control to your form eh...
Laterz,
d!m
[Edited by Dim on 07-14-2000 at 02:43 AM]
What version of MSInet.ocx are you using? Does it give you the error message that it can't load on the form? Well...I have a solution for that....and you can download the fix for it here: http://www.planet-source-code.com/vb...txtCodeId=4860Quote:
Originally posted by michelle
Dear Matthew Gates,
I can't get the code running. Some objects are not understood.
Please can you references?
Thanks a lot.
Michelle.
i suppose the bBin has to be declared as
Dim bBin() as Byte
You are correct :).Quote:
Originally posted by ycsim
i suppose the bBin has to be declared as
Dim bBin() as Byte
Maybe that'll work now.Code:Dim iFile As Integer
Dim bBIN() As Byte
Inet1.Cancel ' Stops any current operations
Inet1.AccessType = icUseDefault
Caption = "Downloading.."
bBIN() = Inet1.OpenURL("www.vb-world.net/images/vbworld.gif", icByteArray)
iFile = FreeFile
Open "C:\vbworld.gif" For Binary Access Write As iFile
Put #iFile, , bBIN()
Close iFile
Caption = "Download Complete."
Is this the fasted way to download a picture?Quote:
Code:Dim iFile As Integer
Dim bBIN() As Byte
Inet1.Cancel ' Stops any current operations
Inet1.AccessType = icUseDefault
Caption = "Downloading.."
bBIN() = Inet1.OpenURL("www.vb-world.net/images/vbworld.gif", icByteArray)
iFile = FreeFile
Open "C:\vbworld.gif" For Binary Access Write As iFile
Put #iFile, , bBIN()
Close iFile
Caption = "Download Complete."