Results 1 to 10 of 10

Thread: [RESOLVED] System.DivideByZeroException ERROR (just on some computers)

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    75

    Resolved [RESOLVED] System.DivideByZeroException ERROR (just on some computers)

    Hi,

    I made a downloader program which allows you to download files from the internet.
    I made the program using VB 2008 and a pc running windows 7 professional 32-bit. I also tested the program on a pc running windows vista home 32-bit, on another one running windows 7 pro 64bit, and on another one running Windows XP 32 bit. It works fine on all of them.

    But today I tried it for the first time on other three different PCs running:
    -Windows 7 starter (32-bit)
    -Windows 7 Home (64-bit)
    -Windows XP (32-bit)

    On all three of them it gave me an error right after I click the download button:
    "System.DivideByZeroException"

    this is the exact error (sorry it is in italian):
    Code:
    ************** Testo dell'eccezione **************
    System.DivideByZeroException: Tentativo di divisione per zero.
       in WindowsApplication1.Form1.Download_DownloadProgressChanged(Object sender, DownloadProgressChangedEventArgs e) in C:\Documents and Settings\Administrator\Desktop\downloader\Form1.vb:riga 221
       in System.Net.WebClient.OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
       in System.Net.WebClient.ReportDownloadProgressChanged(Object arg)
    If I click on "quit" the program closes, if I click on "continue" it just keeps working nice as it should do! (so i do not see the point of this error actually)
    (All the PCs have the latest framework 4.0 installed and anything else needed to make the program run correctly)

    Now, I figured out that the error happens here:
    Code:
    Dim kbps As Long = kbDownloaded \ Time
            If kbps < 1024 Then
                Label5.Text = String.Format("Download Speed: {0} KB/s", kbps)
            Else
                Label5.Text = String.Format("Download Speed: {0:0.00} MB/s", kbps / 1024)
            End If
    So here is what I did to "fix" it (note that I also had to change from backslash "\" to slash "/"):

    Code:
            If (kbDownloaded / Time) < 1024 Then
                Label5.Text = String.Format("Download Speed: {0} KB/s", kbDownloaded \ Time)
            Else
                Label5.Text = String.Format("Download Speed: {0:0.00} MB/s", (kbDownloaded / Time) / 1024)
            End If
    The thing is that right now it gives me a problem with the download speed! If I stop the download and then restart it (from the beginning) the download speed get crazy and it goes like 1kb/s, 2kb/s, 3kb/s, 4kb/s, 5kb/s, 6kb/s,.. and so on.

    How is all this even possible?
    The program works fine on four different PCs but then it gives that error on three others! Is there a way to fix this problem? I cannot believe that it just random works on some computers and on some other it does not.

    One more thing I would like to add is that the versions of windows where the program works are all in English language while the version of windows where the program does not work are all in Italian. Can this make the difference? If so, how can I fix it? I also tried to rebuild the exe on the one pc running windows xp in italian but it did not help! I also tried to rebuild it using visual studio 2010 but no luck

    Please help.

    Thank you in advance,

    Andrea
    Last edited by Netmaster; Feb 13th, 2011 at 01:18 AM.

Tags for this Thread

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