mardi 10 mars 2015

C# use a method on another form

On my main form in my Windows C# application I have this method:



public void uploadNew(String newName, String filePath)
{
//Make sure file doesn't exist, then continue
if (!File.Exists(basePath + POnumber + newName))
{
File.Copy(filePath, basePath + POnumber + newName);
LogSubmit("Added New File " + newName);
listFiles();
}
else
{
//The file already exists
}
}


The meaning of the code really doesn't matter. Here's what I am trying to do. I needed a new form for a file upload form with some options and such. What I need is to send two variables back to the main form to plug into that method.


The operation is essentially this.


Main form -> Click button -> Form 2 -> operations -> Send back variables to uploadNew -> Close Form 2


Aucun commentaire:

Enregistrer un commentaire