Here is what my code looks like:
private void exportToExcelButton_Click(object sender, EventArgs e)
{
txtBox.Clear();
txtBox.AppendText("Beginning Export...");
ExportExcel(txtBox);
txtBox.AppendText("Export complete...");
}
The problem I am having is that whenever the button is clicked (to execute the function above), only part of the current text in the TextBox (System.Windows.Forms.TextBox
) is cleared, and replaced with the first line: "Beginning Export ...".
However once the function ExportExcel(txtBox)
is done executing, then the entire text is replaced by the new one generated in ExportExcel(txtBox)
.
Inside ExportExcel(txtBox);
I have several txtBox.AppendText()
statements explaining to the user the actions being made.
I have tried clearing the text with txtBox.Text = String.Empty;
and txtBox.Text = "";
and neither have worked.
Let me know if anything needs to be clarified, thanks.