Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > Components & Controls > Net / Sockets

Net / Sockets Components for network and related use

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-03-2008, 3:06 AM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-03-2008, 8:16 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Use one of the other UploadFile methods where you can specify more parameters, one of them is the showUI Boolean value which make it display progress and allow user to cancel. You can also tell it what to do if users cancels, ie do nothing or throw an exception. The user and pass parameters you can set to empty string, which is also default values for the UploadFile overload you're using now.

Your other questions not related to this topic were split to other threads, see your thread list (from your forum page) Find all threads started by LeonLanford. Post different topics in separate threads in relevant forums.
.
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-03-2008, 8:28 AM
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

Quote:
Originally Posted by JohnH View Post
Use one of the other UploadFile methods where you can specify more parameters, one of them is the showUI Boolean value which make it display progress and allow user to cancel. You can also tell it what to do if users cancels, ie do nothing or throw an exception. The user and pass parameters you can set to empty string, which is also default values for the UploadFile overload you're using now.

Your other questions not related to this topic were split to other threads, Visual Basic .NET Forums - Search Results
. Post different topics in relevant forums.
Sorry.. I don't understand.. Can you give example?
and sorry for irrelevant topic, I thought it can be merged into one about uploading..

thanks..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-03-2008, 8:33 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

See the code example in help topic: Network.UploadFile Method (String, String, String, String, Boolean, Int32, UICancelOption) (Microsoft.VisualBasic.Devices)
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-03-2008, 10:21 AM
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

Thanks it's working

but can I hide the upload destination and add upload process percentage?

and can I add more that one file to upload in one single button click?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-03-2008, 10:39 AM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,322
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

No, not with this method. You can call this method once for each file you want to upload in button click (via threading).
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-03-2008, 10:45 AM
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

Quote:
Originally Posted by JohnH View Post
No, not with this method. You can call this method once for each file you want to upload in button click (via threading).
What method I should use? I should make new function?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 4:20 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.