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 8357319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:26:24+00:00 2026-06-09T10:26:24+00:00

My application needs to save a JPEG image file with a file name provided

  • 0

My application needs to save a JPEG image file with a file name provided in a TextBox. I don’t want to use SaveFileDialog because I don’t want the user to see the dialog or be able to change the location of the saved image.

How can I set the name of the saved file from a TextBox?

private void button1_Click(object sender, EventArgs e)
{
    if (textBox4.Text.Length >= 1)
       bitmap.Save(@"C:\Test.jpg");
}
  • 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-06-09T10:26:26+00:00Added an answer on June 9, 2026 at 10:26 am

    What about:

    if(filename.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
       bitmap.Save(textBox4.Text);
    else
       MessageBox.Show("Error: the file name contains invalid chars");
    

    EDIT:

    That doesn’t work. Because it must save the file to C: and the file
    must be a jpg image, just like my code. I know how to solve this with
    SaveFileDialog, but i don’t want to see any dialog saving the file and
    the users must not change where i want to save it.

    if(filename.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
       bitmap.Save(@"C:\" + textBox4.Text + ".jpg");
    else
       MessageBox.Show("Error: the file name contains invalid chars");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to save some custom data into application configuration file and I need
I'm writing a Qt application that needs to save some settings to the user's
I'm working on web application which, among other things, needs to save small file
In my application I need to save a file(image,pdf,txt) to a folder. I need
I have an iPhone application that needs to save an image onto the database
I am designing an application that needs to save geometric shapes in a database.
(sorry for my english) I need save an image in the application path and
I need to save an camera image from my application to the desktop so
I have image file placed on the one server and application on other server.
My .NET application needs to access specific file types without searching the entire system.

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.