Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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");

  • *Gurus*
Posted

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");

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

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...