IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Visual Studio Discussion :

erreur code source


Sujet :

Visual Studio

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2013
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2013
    Messages : 70
    Par défaut erreur code source
    Bonjour à tous,
    je débute dans la programmation logicielle avec visual studio 2010. Je suis en plein développement d'un programme de téléchargement sur internet et quant je clique sur le bouton Download j'ai ce message qui apparaît et vu mon niveau je n'arrive pas à comprendre:
    http://img15.hostingpics.net/pics/665687Capture.jpg .
    Amis programmeurs, aidez-moi s'il vous plaît.

    tout le code source:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    Imports System.Net
    Public Class Form1
     
        Private WithEvents httpclient As New WebClient
     
        Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
            SaveFileDialog1.ShowDialog()
            TextBox2.Text = SaveFileDialog1.FileName
        End Sub
     
        Private Sub btnDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDownload.Click
            httpclient = New WebClient
            Dim download As String = TextBox1.Text
            Dim save As String = TextBox2.Text
            httpclient.DownloadFileAsync(New Uri(download), save)
            lblCurrentStart.Text = "Current Status: Downloading..."
        End Sub
     
     
        Private Sub httpclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
            ProgressBar1.Maximum = e.TotalBytesToReceive
            ProgressBar1.Value = e.BytesReceived
            lblDownloadStart.Text = "Download Status: " & e.ProgressPercentage & "%"
     
            If e.ProgressPercentage = 100 Then
                lblCurrentStart.Text = "Current Status: Finished"
            End If
        End Sub
     
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ProgressBar1.Style = ProgressBarStyle.Blocks
            lblCurrentStart.Text = "Current Status: Waiting"
        End Sub
     
        Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            httpclient.CancelAsync()
        End Sub
     
        Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
     
        End Sub
     
        Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
     
        End Sub
     
        Private Sub lblCurrentStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblCurrentStart.Click
     
        End Sub
     
        Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
            httpclient = New WebClient
            Dim download As String = TextBox1.Text
            Dim save As String = TextBox2.Text
            httpclient.DownloadFileAsync(New Uri(download), save)
            lblCurrentStart.Text = "Current Status: Downloading..."
        End Sub
     
        Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click
            httpclient.CancelAsync()
        End Sub
     
        Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
            SaveFileDialog1.ShowDialog()
        End Sub
     
        Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
            Dim f As New Form1
            f.Show()
        End Sub
     
        Private Sub PictureBox7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.Click
            Form6.Show()
        End Sub
     
        Private Sub FichierToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub AideToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
     
        End Sub
     
        Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click
     
        End Sub
     
        Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
            TextBox1.Text = Nothing
            TextBox2.Text = Nothing
            ProgressBar1.Minimum = 0
        End Sub
     
        Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
     
        End Sub
     
        Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
     
        End Sub
    End Class
    Merci davance

  2. #2
    Expert confirmé Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Par défaut
    IL y a des chances que e.BytesReceived soit égal à -1 parce que le fichier à télécharger n'est pas trouvé sur le serveur.

  3. #3
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2013
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2013
    Messages : 70
    Par défaut
    Salut et merci de m'éclaire, je suppose que vous faîtes allusion à ça:

  4. #4
    Expert confirmé Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Par défaut
    Oups, Je me suis trompé de ligne :
    Si le fichier est lu dans un site FTP, l'erreur vient du fait que, contrairement à HTTP, FTP ne renvoie pas dans e.TotalBytesToReceive le nombre d'octets à recevoir.

  5. #5
    Membre confirmé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2013
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Côte d'Ivoire

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2013
    Messages : 70
    Par défaut
    bonjour,
    et encore merci pour tout mais comment résoudre ce problème?

  6. #6
    Expert confirmé Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Par défaut
    Peut-être ainsi :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    ProgressBar1.Maximum = 100
    ProgressBar1.Value = e.ProgressPercentage
    sans garantie

Discussions similaires

  1. Réponses: 2
    Dernier message: 01/06/2010, 15h03
  2. j'arrive pas à compiler mon code source java il me met l'erreur suivante
    Par safa baccouche dans le forum Débuter avec Java
    Réponses: 1
    Dernier message: 17/08/2009, 22h46
  3. Réponses: 2
    Dernier message: 26/05/2009, 09h58
  4. erreur dans le code source
    Par oracle.walid dans le forum C++
    Réponses: 4
    Dernier message: 06/01/2007, 16h17
  5. erreur sur un code source basique
    Par helix_tp dans le forum Langage
    Réponses: 4
    Dernier message: 23/01/2006, 21h55

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo