Thanks for your help!
In my Form1 Class the StreamWriter is declared like this:
private System.IO.StreamWriter logWriter;
later on is this function:
private void connectButton_Click(object sender, System.EventArgs e)
{
String host = this.hostTextBox.Text;
int port = Convert.ToInt32(this.portTextBox.Text);
DirectoryInfo localDirectory;
try
{
//connect to client
client = new FTPClient(host, logWriter, port);
logIt();
//turn on debugging
client.DebugResponses(true);
//login in to client
client.Login(userTextBox.Text, passTextBox.Text);
logIt();
//Get remote directory
remoteDirTextBox.Text = client.Pwd();
logIt();
//Populate Remote ListBox
remoteDirListBox.Items.AddRange(client.Dir());
logIt();
//Poputlate Local ListBox
localDirectory = new DirectoryInfo(localDirTextBox.Text);
localDirListBox.Items.AddRange(localDirectory.GetDirectories());
localDirListBox.Items.AddRange(localDirectory.GetFiles());
}
catch(Exception errorCode)
{
catchBox.Text = errorCode.Message;
}
}
The LogIt() function is this:
private void logIt()
{
logBox.Text += logWriter.ToString();
logWriter.Flush();
}