I have a simple form with a text box, a command button and a couple of timers. The only purpose of the form is to advise the user what is happening. The program executes all the code as required EXCEPT for the textbox changes. I know the code to implement the textbox changes is executed because the form and the command button properties change as required.
I have added this.refresh and this.textbox1.refresh to no avail.
I am new to C# and most of the time I do not have Visual Studios available, so your assistance would be most appreciated. I have read other posts on this topic and probably the answer has already been given, but I have not understood the solution.
The simplified code is given below:
static class Program
/// The main entry point for the application.
static void Main(string args)
public partial class Form1 : Form
public Form1(string args)
sUrl = args;
sFileName = args;
sCorNo = args;
timer1.Enabled = true;
timer2.Enabled = true;
public void PostCode()
const string boundary = "----WebKitFormBoundaryePkpFF7tjBAqx29L";
//Do all general code work here.
//Alter form to show successful post to web
this.button1.Visible = true;
this.button1.Enabled = true;
this.BackColor = System.Drawing.Color.FromArgb(189,194,241);
this.textBox1.Text = sCorNo + " Outlook file saved to FuseDMS."; // this code is executed but is not reflected on the Form
this.textBox1.BackColor= System.Drawing.Color.FromArgb(189,194,241); // this code is executed but is not reflected on the Form
private void timer1_Tick(object sender, EventArgs e)
timer1.Enabled = false;
private void timer2_Tick(object sender, EventArgs e)
timer2.Enabled = false;
this.textBox1.Text = "Saving Message " + sCorNo + ".";
private void button1_Click(object sender, EventArgs e)
As @DavidG pointed out, you should not call
InitializeComponent() periodically or even more then once, do it as the first thing in the constructor.
This is because any controls and properties that you add/set from the designer are created and initialized in this method.
Another thing to point out is
Timer.Enabled = true and
Timer.Start() effectively do the same thing
Calling the Start method is the same as setting Enabled to true. Likewise, calling the Stop method is the same as setting Enabled to false.