Need to forms to function as one.

I'll start of by saying I am by no means the best programmer, so please excuse me. In order to tidy up my form, I decided to offload a portion of the program to a new form. So I have a main form, and a second form for one particular function.

I'm going to try to simplify as much as possible and only give as much info as needed.

Form 1:

The first form displays the contents of a folder in a list box and has some buttons to modify, delete, and open the files. After a file is deleted there is a function to refresh the list box and edits a log file. There are also a lot of things that are just dependent on that form I need such as variables.

Form 2:

There is also an option to add a file, but it's a little more complicated because I have them select the type of file from a drop down and blah blah blah.. point is this button needs some extra prep work that I want on a separate form. So here I have my separate form, who's purpose is really only to get me 2 variables I need.

This code is in my Form 1

 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 MessageBox.Show("This file already exists in this location! \n Did you mean to add a revision? If so select the existing file and click \"Add rev\"", "File already exists."); } } 

I need to pass the two variables from the second form into this function after the user clicks a button on the form 2.

by Ampix0 via /r/csharp

Leave a Reply