|
-
Jul 13th, 2000, 04:48 PM
#1
How do i download a file to the c drive using vb?
-
Jul 13th, 2000, 04:56 PM
#2
Also, how do i perform an action based on whats selected in a list box?
-
Jul 13th, 2000, 05:13 PM
#3
Addicted Member
ListBoxes
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:
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
Hope it helps.
Regards
NEW2VB
-
Jul 13th, 2000, 05:14 PM
#4
Lively Member
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
YC Sim
Teenage Programmer
UIN 37903254
-
Jul 13th, 2000, 05:40 PM
#5
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
-
Jul 14th, 2000, 12:19 AM
#6
I couldnt find that demo, could someone just explain it to me.
-
Jul 14th, 2000, 12:35 AM
#7
Try one of these:
Try the execute command.
Code:
Inet1.Execute "http://www.somewhere.com/index.html", "GET"
or download pictures or files with the Inet control.
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."
Hope that helps.
-
Jul 14th, 2000, 01:39 AM
#8
Hyperactive Member
Dear Matthew Gates,
I can't get the code running. Some objects are not understood.
Please can you references?
Thanks a lot.
Michelle.
-
Jul 14th, 2000, 01:40 AM
#9
Fanatic Member
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]
-
Jul 14th, 2000, 02:01 AM
#10
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.
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=4860
-
Jul 14th, 2000, 06:18 AM
#11
Lively Member
i suppose the bBin has to be declared as
Dim bBin() as Byte
YC Sim
Teenage Programmer
UIN 37903254
-
Jul 14th, 2000, 09:51 PM
#12
Originally posted by ycsim
i suppose the bBin has to be declared as
Dim bBin() as Byte
You are correct .
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."
Maybe that'll work now.
-
Jul 3rd, 2005, 01:40 PM
#13
Hyperactive Member
Re: Downloading a file
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|