falco Posted February 26, 2003 Posted February 26, 2003 Can someone explain why I am getting the following build errors? No overload for method 'File' takes '1' arguments 'System.IO.File' does not contain a definition for 'CopyTo' Code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; File adofile = new File("C:\\dotNET Book\\Ch8_ADO.doc"); adofile.CopyTo("C:\\dotNETBook\\Sample\\Ch8_Backup.doc"); Quote
*Gurus* divil Posted February 26, 2003 *Gurus* Posted February 26, 2003 It's not working because there is no contructor on the File class, as it said. You can't just invent syntax like this. To copy a file, you use the static method of the File class: System.IO.File.Copy("C:\\dotNET Book\\Ch8_ADO.doc", "C:\\dotNETBook\\Sample\\Ch8_Backup.doc"); Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
falco Posted February 26, 2003 Author Posted February 26, 2003 Once again, you da man! Thank you for guiding this blind rookie through what must seem like such basic stuff. Quote
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.