Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This is similar to my post about "Delete button" but now I need to find out how to make a Copy To... button for my form.

 

Once again im using a listbox, and now I need it so when the copy to button is clicked it will copy the screenshot to a location. I would prefer it to bring up a box that would do a Save As type thing so they can pick where to copy it to.

Posted

Or actually, if it is simplier, I would like it to copy to their desktop. Maybe there is a code like:

 

System.IO.File.Copy(Application.UserDesktop)

 

 

that doesn't work, but maybe its close to what will?

Posted

It said it could not find part of the path.. here is what I put, maybe you can see if I put something wrong.

 

       System.IO.File.Copy(Application.StartupPath & "\Sidekick Files\Image Viewer\" & ListBox1.Text, Environment.SpecialFolder.Desktop & "\" & ListBox1.Text)

Posted (edited)

I think it has something to do with the Evironment.SpeacialFolder.Desktop part because i repaced it with a different path and it worked.

 

EDIT: heres the error message

 

Could not find a part of the path "0\ScreenShot0.bmp".

Edited by Lanc1988
  • *Experts*
Posted

Well if you showed everything exactly as you have it, then the line:

Environment.SpecialFolder.Desktop

is returning the string "0".

 

Can you create a simple Console app and see what the line "Environment.SpecialFolder.Desktop" shows?

 

Maybe it needs a ToString() or something similar on the end (to get the path as a string)?

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
Shouldn't it work though? I have an install for this program and I have it create a shortcut to my program on the user's desktop.. so is "Environment.SpecialFolder.Desktop" the same thing?
Posted

PlausiblyDamp, surely you have to know whats wrong with what I put, you posted what I needed to do..

 

so whats wrong with this:

System.IO.File.Copy(Application.StartupPath & "\Sidekick Files\Image Viewer\" & ListBox1.Text, Environment.SpecialFolder.Desktop & "\" & ListBox1.Text)

  • Leaders
Posted

SpecialFolder is an enumeration.

To get the filename, you need to use the Environment.GetFolderPath.

 

MessageBox.Show(System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop))

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...