Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using (WebClient client = new WebClient())
{
string url = textBox1.Text;
string filePath = @"C:\Users\Koyya\OneDrive\Desktop\example.txt";
client.DownloadFile(url, filePath);
MessageBox.Show("dome");
}
}
}
}
========================
Steps
1. Create a new project using Windows Forms App (.NET Framework)
2.Add Controls to the Form using ToolBox
TextBox → for entering URL (textBox1)
Button → for DOWNLOAD (buttonDownload)
Button → for UPLOAD (button1)
Label → to show status (label1)
3. Double click on both the buttons and paste the above functions in those functions of respective buttons
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter