It looks like you are using a variable called destination in this line
webClient.DownloadFile("http://i.imgur.com/" + picture, destination + picture);
however you have not declared that variable and assigned it a value inside the buttonStart_Click method.
You have a variable called destination declared in the buttonSaveTo_Click method, if this is the value you want to use in buttonStart_Click, you need to make it a class level field so declare it next to ‘bool flag’
e.g:
public partial class Form1 : Form
{
bool flag = true;
int downloadedNumber = 0;
string destination;
}
and remove the string declaration from
public void buttonSaveTo_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.ShowDialog();
richTextBox1.Text = fbd.SelectedPath;
destination = fbd.SelectedPath;
}
solved saving file to folder [closed]