Results 1 to 40 of 132

Thread: Download Files From Web With Progressbar

Hybrid View

  1. #1
    New Member S-One's Avatar
    Join Date
    Jun 2008
    Posts
    11

    Re: Download Files From Web With Progressbar

    Quote Originally Posted by sdk1985
    Also there are some ! according to VB with the default project. (I am now using an exact copy of webfiledownloader.vb in my program)

    Warning 1 Variable 'FS' is used before it has been assigned a value. A null reference exception could result at runtime. I:\Documents and Settings\Sebas\Mijn documenten\Visual Studio 2005\Projects\FileTransfer\FileTransfer\WebFileDownloader.vb 70 21 FileTransfer

    Warning 2 Function 'FormatFileSize' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. I:\Documents and Settings\Sebas\Mijn documenten\Visual Studio 2005\Projects\FileTransfer\FileTransfer\WebFileDownloader.vb 99 5 FileTransfer
    Hmm, i have converter my project from .net 2003 to 2005 and i also get this Warning, weird, but there is return

    also i get warning abour DialogResult.no, yes, or whatever is used...
    i have resolved this with
    Code:
    System.Windows.Forms.DialogResult....
    EDIT:
    ok i have resolved FormatFileSize Warning Case else is missing:
    Code:
                    Select Case Size / KB
                        Case Is < 1000
                            Return (Size / KB).ToString("N") & "KB"
                        Case Is < 1000000
                            Return (Size / MB).ToString("N") & "MB"
                        Case Is < 10000000
                            Return (Size / MB / KB).ToString("N") & "GB"
                        Case Else
                            Return Size.ToString & "bytes"
                    End Select
    Matt can you explain this please ("D" & "N" is format right):
    Size.ToString("D") .ToString("N")
    also cant find help about URL.IndexOf("/"c) and URL.LastIndexOf("/"c)
    what is c for ? (description is Char, but please explain

    thx in advance !
    Last edited by S-One; Jun 14th, 2008 at 09:29 PM.

  2. #2

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Download Files From Web With Progressbar

    Quote Originally Posted by S-One
    Hmm, i have converter my project from .net 2003 to 2005 and i also get this Warning, weird, but there is return

    also i get warning abour DialogResult.no, yes, or whatever is used...
    i have resolved this with
    Code:
    System.Windows.Forms.DialogResult....
    EDIT:
    ok i have resolved FormatFileSize Warning Case else is missing:
    Code:
                    Select Case Size / KB
                        Case Is < 1000
                            Return (Size / KB).ToString("N") & "KB"
                        Case Is < 1000000
                            Return (Size / MB).ToString("N") & "MB"
                        Case Is < 10000000
                            Return (Size / MB / KB).ToString("N") & "GB"
                        Case Else
                            Return Size.ToString & "bytes"
                    End Select
    Matt can you explain this please ("D" & "N" is format right):
    Size.ToString("D") .ToString("N")
    also cant find help about URL.IndexOf("/"c) and URL.LastIndexOf("/"c)
    what is c for ? (description is Char, but please explain

    thx in advance !
    Yeah this project was originally done in VS2003 (.NET 1.1) they added in some warnings in the newer versions of VS, so that is what you were seeing.

    Those fixes you made were fine.

    "D" is for decimal formatting of a number as a string, and "N" is for general number formatting of a number as a string. In some cases, they may yield the same result, and in others they will not. (usually has to do with number of decimal place precision, etc..)

    Here is a listing of valid numeric formats for calling ToString
    http://msdn.microsoft.com/en-us/libr...9k(VS.80).aspx

    The IndexOf method is a method that simply returns the numeric index of where a given character is in a string of characters.

    So given the string "abccba", the character positions of the letters are as follows:

    a = 0
    b = 1
    c = 2
    c = 3
    b = 4
    a = 5

    So if I were to get the indexof("a"c), it will return 0, as a is found at position 0 in this string, however getting lastindexof("a") does the same thing, but starts at the end of the string, in which case it will find a in position 5, so it will return a 5.

    the c after the specified character is just to tell the compiler "this is a datatype char, not a string with only 1 character". By default VB thinks anything in quotes is a string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width