Thread: Question uploading things..
View Single Post
  #1 (permalink)  
Old 12-03-2008, 3:06 AM
LeonLanford LeonLanford is offline
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Dec 2008
Posts: 28
Reputation: 18
LeonLanford is on a distinguished programming path ahead
Default uploading things..

Hi.. I'm new here.. I'm using visual studio 2005
I just learnt vb.net not too long ago
I just made application to upload file to website but I have problems

1. How to make progress bar while uploading? I can make progress bar working by pressing a button, but don't know how to do it with uploading..
2. How to cancel the upload while uploading? Not closing the application I mean but pressing cancel button

the code is like this

Code:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            My.Computer.Network.UploadFile("C:\ongoing.txt", "http://localhost/tes/uplot.php")
            MessageBox.Show("File uploaded.", "Upload Success")
        Catch ex As Exception
            MessageBox.Show("Access failed" & vbCrLf & ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Interval = 1
        Timer1.Enabled = True
        ProgressBar1.Value = 0
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value < 100 Then
            ProgressBar1.Value += 1
            Label1.Text = ProgressBar1.Value & " %"
            'Me.Label1.BackColor = System.Drawing.Color.Transparent

        Else
            Timer1.Enabled = False
        End If
    End Sub


End Class
thanks.. hope you can help me

Last edited by JohnH; 12-03-2008 at 8:23 AM. Reason: different topic, thread split
Reply With Quote