15,920,438 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10492763 (Top 2 by date)
Member 10492763
13-Jan-14 5:25am
View
what is wrong in my code?
Member 10492763
13-Jan-14 5:04am
View
private void pictureBox2_Click(object sender, EventArgs e)
{
FolderBrowserDialog Save = new FolderBrowserDialog();//Declaring the folder browsing dialog
Save.RootFolder = Environment.SpecialFolder.Desktop;//setting to desktop
if (Save.ShowDialog() == DialogResult.OK)//An if statement to to show the path in textbox
{
string Text = textBox1.Text.ToString();//formatting to string
string[] arry = Text.Split('/');//splitting /
string dad = arry[arry.Length - 1];
ad = dad.Remove(dad.Length - 5);
label5.Text = dad;
path = String.Format("{0}//{1}",Save.SelectedPath,ad);
WebClient wb = new WebClient();
wb.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wb_DownloadProgressChanged);
wb.DownloadFileCompleted += new AsyncCompletedEventHandler(wb_DownloadFileCompleted);
wb.DownloadFileAsync(new Uri(textBox1.Text), path);
timer1.Start();
}
}
void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
timer1.Stop();
DialogResult dr = MessageBox.Show("Yukl?m? bitmisdir! Icra olunsun?", "Bitdi!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
progressBar1.Value = 0;
Process.Start(path);
}
}
void wb_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
label7.Text = e.BytesReceived.ToString() + " bayt";
label6.Text = e.TotalBytesToReceive.ToString() + "bayt";
label8.Text = e.ProgressPercentage.ToString() + "%";
}