Lanc1988 Posted June 3, 2004 Posted June 3, 2004 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. Quote
Lanc1988 Posted June 3, 2004 Author Posted June 3, 2004 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? Quote
Administrators PlausiblyDamp Posted June 3, 2004 Administrators Posted June 3, 2004 something like system.IO.File.Copy( , environment.SpecialFolder.Desktop & "\" & ) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Lanc1988 Posted June 3, 2004 Author Posted June 3, 2004 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) Quote
Lanc1988 Posted June 3, 2004 Author Posted June 3, 2004 (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 June 3, 2004 by Lanc1988 Quote
Lanc1988 Posted June 4, 2004 Author Posted June 4, 2004 Someone know how to fix it? I need it by tomorrow if thats possible. Thanks. Quote
*Experts* Nerseus Posted June 4, 2004 *Experts* Posted June 4, 2004 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 Quote "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
Lanc1988 Posted June 4, 2004 Author Posted June 4, 2004 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? Quote
Lanc1988 Posted June 5, 2004 Author Posted June 5, 2004 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) Quote
Leaders Iceplug Posted June 5, 2004 Leaders Posted June 5, 2004 SpecialFolder is an enumeration. To get the filename, you need to use the Environment.GetFolderPath. MessageBox.Show(System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop)) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.