problem with function in C#

F

Fatemeh

Hi
I want to write a program (FileCopier) that it allow the user to check
files (or entire directories) in the left tree view (source).
If the user presses the Copy button, the files checked on the left
side
will be copied to the Target Directory specified in the right-hand
control.
If the user presses Delete, the checked files will be deleted.
And the user interface for FileCopier consists of the following
controls:
• Labels: Source Files and Target Directory
• Buttons: Clear, Copy, Delete, and Cancel
• An Overwrite if exists checkbox
• A text box displaying the path of the selected target directory
• Two large tree view controls, one for available source directories
and one for available target devices and directories.
But this error occurred is a function (GetFileList) of program:

"Class 'File_Copier.Form1' already defines a member called
'GetFileList'
with the same parameter types"

This function gets filenames and directory from system:
Function GetFileList:
private ArrayList GetFileList( )
{
// create an unsorted array list of the full file names
ArrayList fileNames = new ArrayList();

// fill the fileNames ArrayList with the
// full path of each file to copy
foreach (TreeNode theNode in tvwSource.Nodes)
{
GetCheckedFiles(theNode,fileNames);
}
// Create a list to hold the FileInfo objects
ArrayList fileList = new ArrayList();

// for each of the file names we have in our unsorted list
// if the name corresponds to a file (and not a directory)
// add it to the file list
foreach (string fileName in fileNames)
{
// create a file with the name
FileInfo file = new FileInfo(fileName);

// see if it exists on the disk
// this fails if it was a directory
if (file.Exists)
{
// both the key and the value are the file
// would it be easier to have an empty value?
fileList.Add(file);
}
}
}

Email : <[email protected]>
Best regards,
Fatemeh Hashemian
 
E

Eric Johannsen

There is a really good chance that you already define a function called
GetFileList() in Form1.cls. Do a text search and see if you have it defined
somewhere else as well.

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top