Passing Args from Method to Click Event Method in C#
<p>Firstly, I am most comfortable coding in Java. I am creating an application in C# as a learning tool. In this app I am calling a method from a Click Event Method.</p>

<pre><code>    private void btnViewFile_Click(object sender, EventArgs e) {
        GetFileNames();
        lblOutputPath.Text = sb;
    }

    private StringBuilder GetFileNames() {
        StringBuilder sb = new StringBuilder();
        string[] fileNames = Directory.GetFiles(Dir);
        foreach (string s in fileNames)
            sb.Append(s);

        return sb;
    }
</code></pre>

<p>I want to break out the code that gets the FileNames of each file in the directory out of the Click method to keep it more modularized. I would get a value for the StringBuilder object and then pass it back into the Click event method. </p>

<p>That's how I would do it in Java at any rate. Is this an effective tack or is there a better way to do this? </p>
