![]() |
|
|||||||
| Net / Sockets Components for network and related use |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi.. I'm new here..
I'm using visual studio 2005I 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
Last edited by JohnH; 12-03-2008 at 8:23 AM. Reason: different topic, thread split |
|
||||
|
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..
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Quote:
and sorry for irrelevant topic, I thought it can be merged into one about uploading.. thanks.. |
|
||||
|
See the code example in help topic: Network.UploadFile Method (String, String, String, String, Boolean, Int32, UICancelOption) (Microsoft.VisualBasic.Devices)
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Quote:
![]() 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? |
|
||||
|
No, not with this method. You can call this method once for each file you want to upload in button click (via threading).
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
What method I should use? I should make new function?
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|