Quote:
|
Originally Posted by tristolas
For WebClient.DownloadFile Method, I don't know where to start; a console or windows application?
can I use this method within either one?
|
Should be able to, yeah. As for which is best, it depends on your needs. I suspect (from the fact the images are named with sequential strings) that it will function in a batch manner; as such, a console-mode program is just fine. If you want to prompt the user for the base URL or base filename (before the appended number), then a Windows forms app might be better, but you can certainly do this in a console program as well, whether through the use of command-line parameters, or input prompts. Likewise, a forms app can run without any input from the user (besides starting the app, of course).
Quote:
|
Originally Posted by tristolas
If I do windows form,
would I just replace Public Class Form1 with Public Class WebClient or do I have to edit the "meta-file" with
<ComVisibleAttribute(True)> _
Public Class WebClient
Inherits Component
|
You don't inherit from the class (well, not unless you're planning on changing its feature set). In this case, inheritance is unnecessary; all you need to do is instantiate a WebClient object, and call the appropriate method. All that other stuff is not needed, and will only serve to confuse matters.
Quote:
|
Originally Posted by tristolas
Also the only way I know how to trigger the method(download file) is through a button declared as Private Sub Button1_Click()... but can I declare Public Sub DownloadFile() inside of this^ Private ButtonClick Sub ?
|
If it's a forms app, and you want user input (say, web URL, or base filename), then doing it from a button click handler is fine (preferred, in fact). If you are hard-coding this, reading it from a configuration file, or otherwise determining it without user intervention, then you can do it in the form's load event handler (for a forms app) or in the main method (not sure what VB calls it, as I've not done console apps in VB, but it's probably main).
Quote:
|
Originally Posted by tristolas
Then would I just stick the method inside of an incrementing loop ?
|
Yup, much as you've done. All you really need to do in the loop is a) build the URL (URI) string, b) build the local filename string, and c) call the DownloadFile() method. I suggested DownloadData() because I figured you might want to do processing before saving, but if not, DownloadFile() is easier to use (especially since you don't need to determine the file size before starting the download).
Quote:
|
Originally Posted by tristolas
Is doing it through console or wget script is simpler (requires less steps) ?
|
Dunno about wget, as I've not used it, but via console, it's pretty simple. See my points above about console vs forms versions.