TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rampradeep kalivarapu
NA
56
12.4k
Downloading with progressbar in win form.
Oct 20 2015 8:35 AM
Hai...i have tried below code for provide progressbar option while downloding a file.But in my code
void client_DownloadProgressChange eventprocedure not fired not getting any idea.please solve this.
MY CODE:
public partial class Progressbarwithdownload : Form
{
public Progressbarwithdownload()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFileAsync(new Uri(@"D:\Swathi\modalform\modalform\ASP .NET MVC.pdf"), "D:\\");
button1.Text = "Download In Process";
button1.Enabled = false;
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
double bytesIn = double.Parse(e.BytesReceived.ToString());
double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
double percentage = bytesIn / totalBytes * 100;
progressBar1.Value = int.Parse(Math.Truncate(percentage).ToString());
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download Completed");
button1.Text = "Start Download";
button1.Enabled = true;
}
}
Reply
Answers (
0
)
Spliting single word in saperate charecter
Excel not installed in server..!