I use this code Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try Timer1.Start() File.Copy(TextBox1.Text, TextBox2.Text, True) Label5.Text = 'file copied.' You may use the marquee style progress bar or show animated gif images for showing the progress. So you want to use simple thread program for achive this one. 'Try this one.' ------------------------------------------------------'----------------Public Class Form1Private objFrm2 As New Form2Private th As New Threading.ThreadPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click.Call ShowLoading() 'Here do you process.'
.If th IsNot Nothing Then th.Abort() objFrm2.Close()End IfEnd SubPrivate Sub ShowLoading() If Me.InvokeRequired Then objFrm2.ShowDialog() Else'Start the thread that will execute this method th =New Threading.Thread(AddressOf ShowLoading) th.IsBackground =True th.Start()End IfEnd SubEnd Class'------------------------------------------------'In form2 just u add a picture box with animated 'process gif image for showing the process.' I hope u now get the solution. If you dont have animated gif images then use progress bar under with Marquee style. If a post answers your question, please click 'Mark As Answer' on that post and 'Mark as Helpful'. Remove your Timer1 and its code. Replace your Button1_Click method with: Private Sub Button1_Click( ByVal sender As Object, ByVal e As EventArgs ) Handles Button1.Click Button1.Enabled = False Dim WC As New Net.
WebClient AddHandler WC.DownloadProgressChanged, AddressOf WC_ProgressChanged AddHandler WC.DownloadFileCompleted, AddressOf WC_Complete WC. Nokia C2 Facebook Apps. DownloadFileAsync( New Uri (TextBox1.Text), TextBox2.Text) End Sub Sub WC_ProgressChanged(sender As Object, e As Net. DownloadProgressChangedEventArgs ) ProgressBar1.Value = e.ProgressPercentage End Sub Sub WC_Complete(sender As Object, e As System.ComponentModel. AsyncCompletedEventArgs ) If e.Error Is Nothing Then Label5.Text = 'file copied' Else MsgBox(e.Error.ToString) End If End Sub.
Jul 06, 2006 CopyFile() and Progress Bar? As i said the VB6 code gives a progress callback during the copy of a file so you get the progress of the file actually beeing copied.
Alright, so in yesterday's thread, I asked for the codes to copy the contents of a directory to a separate directory. The code: My.Computer.FileSystem.CopyDirectory(,, ) worked fine. However, I have decided that I wish to add a progress bar into the mix so that the user can see the progress of the transfer copy. Updated code from. 1 Button, 1 ProgressBar Imports System.IO Public Class Form1 Private sTemp1, sTemp2 As String '// TEMP.Strings, used as needed. Private Sub Button1_Click(sender As System. Votre Pc Prend La Parole Youtube here. Object, e As System.EventArgs) Handles Button1. Sid Changer For Vista on this page. Click Dim fbd As New FolderBrowserDialog: sTemp1 = ': sTemp2 = ' With fbd.Description = 'Select a folder to copy the content FROM.'