We help IT Professionals succeed at work.

How to save a file without using SaveFileDialog control?

1,406 Views
Last Modified: 2013-11-26
Dear Experts:
I'm developing windows based application using VB.net. I would like to save an image to a specific folder without using SaveFileDialog control. I have a button to browse for image using OpenFileDialog. Once the image is selectd from some folder the image gets set to an image holder (PictureBox) the Private strImagePath will be holding the file name and path. Now I have another button that should save the image inside the folder that I want without using savefiledialog control. any help is really appreciated.
Comment
Watch Question

High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Top Expert 2007

Commented:
Here's an example:

        Dim saveDiag As New SaveFileDialog()
        saveDiag.ShowDialog()

        Dim sText As String = "Text to save to file"

        My.Computer.FileSystem.WriteAllText(saveDiag.FileName, sText, False)

Top Expert 2007

Commented:
Oops, sorry.  Here you go:

        Dim strImagePath As String = "C:\starbucks logo.jpg"
        Dim savePath As String = "c:\temp\" & System.IO.Path.GetFileName(strImagePath)
        With My.Computer.FileSystem
            .WriteAllBytes(savePath, .ReadAllBytes(strImagePath), False)

        End With

        MsgBox("Saved")

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.