Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7506241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:11:54+00:00 2026-05-29T22:11:54+00:00

it doest work:<, here is my code: public void buttonSaveTo_Click(object sender, EventArgs e) {

  • 0

it doest work:<, here is my code:

        public void buttonSaveTo_Click(object sender, EventArgs e)
    {
        FolderBrowserDialog fbd = new FolderBrowserDialog();
        fbd.ShowDialog();
        richTextBox1.Text = fbd.SelectedPath;
        string destination = fbd.SelectedPath;
    }

and this is how i try to save files

                {
                webClient.DownloadFile("http://i.imgur.com/" + picture, @"destionation" + picture);
            }

EDIT// okay thanks for answers but it still doesnt work:<, maybe im doing omething wrong, look this is all code i wrote

namespace Imgur
{
public partial class Form1 : Form
{
bool flag = true;
int downloadedNumber = 0;

    public Form1()
    {
        InitializeComponent();
    }

    public void buttonStart_Click(object sender, EventArgs e)
    {
        buttonStart.Enabled = false;
        buttonStop.Enabled = true;
        if (!flag)
        {
            flag = true;
        }

        for (int i=0;i<100000 && flag;i++)
        {
            WebClient webClient = new WebClient();
            string pic1 = rnd_str(5);
            string pic2 = ".jpg";
            string picture = pic1 + pic2;

            //********** GETTING SIZE OF IMAGE ***********
            Size sz = GetSize("http://i.imgur.com/" + picture);
            string imageSize = (sz.Width.ToString() + " " + sz.Height.ToString()); ;
            //********************************************

            if(imageSize != "161 81")
            {
                webClient.DownloadFile("http://i.imgur.com/" + picture, destination + picture);

                richTextBox1.Text += String.Format("Downloaded picture: {0}\r\n", picture);
                downloadedNumber++;
                textBoxDownloadedNumber.Text = string.Format("{0}", downloadedNumber);
            }
            webClient.Dispose();
            Application.DoEvents();
            if (i == 999995)
            {
                flag = false;
            }
        }
        richTextBox1.Text += "theend\n";
        buttonStart.Enabled = true;
        buttonStop.Enabled = false;
    }

    public static Size GetSize(string url)
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "GET";
        request.Accept = "image/gif";
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        Stream s = response.GetResponseStream();
        Bitmap bmp = new Bitmap(s);
        Size sz = new Size(bmp.Width, bmp.Height);
        return sz;
    }

    public static string rnd_str(int liczba_liter)
    {
        Random r = new Random();
        int char_type;
        string return_string = "";
        int i =0;
        for (i = 0; i < liczba_liter; i++)
        {
            if (r.Next(1, 3) == 1)
            {
                char_type = r.Next(1, 4);
                switch (char_type)
                {
                    case 1:
                        return_string += (char)r.Next(48, 58); // convertion int -> ASCII character; 48-57 are ASCII digits
                        break;
                    case 2:
                        return_string += (char)r.Next(97, 123); // convertion int -> ASCII character; as above but small letters
                        break;
                    case 3:
                        return_string += (char)r.Next(65, 91); // as above; large letters
                        break;
                    default:
                        i -= 1;
                        break;//do not add any letter if no type is allowed
                }
            }
            else
            {
                i -= 1;
                return_string += "";
            }
        }
        return return_string;
    }

    private void buttonStop_Click(object sender, EventArgs e)
    {
        flag = false;
        buttonStart.Enabled = true;
    }

    public void buttonSaveTo_Click(object sender, EventArgs e)
    {
        FolderBrowserDialog fbd = new FolderBrowserDialog();
        fbd.ShowDialog();
        richTextBox1.Text = fbd.SelectedPath;
        string destination = fbd.SelectedPath;
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:11:57+00:00Added an answer on May 29, 2026 at 10:11 pm

    You are currently just concatenating strings, but your folder name probably does not end with a directory separator char. Assuming picture is the file name of your picture (e.g. foo.jpg) use Path.Combine() instead to let the framework do the work for you:

    var localFileName = Path.Combine(destination, picture);
    webClient.DownloadFile("http://i.imgur.com/" + picture, localFileName);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my code: int ypos = 0; public void X() { MovieItem NewMovie =
Here is my code: public class Main { public static void main(String[] args) {
I have a piece of code here that does not work despite me using
here is my code it shares the folder but that does not work correctly
Here's the code, I don't quite understand, how does it work. Could anyone tell,
Here's what I'm trying to do -- this is pseudo code and doesn't work.
I have an *.ashx (handler) with this code: public void ProcessRequest (HttpContext context) {
I have to implement quicksort. From Programming Pearls here is the code: public class
I'm trying to get the code here to work. It compiles fine. It will
How does async JMS work? I've below sample code: public class JmsAdapter implements MessageListener,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.