Zebra0.com

csharp richtextZebra Notes: Open, Save, Save As, and Format with a Rich Text Box

Zebra Notes: Open, Save, Save As, and Format with a Rich Text Box

We will display the date and time in the status bar.

Enable the timer either in the properties window, or by adding the code to form load.

Write the code as shown below:

private void Form1_Load(object sender, EventArgs e)
{
   // At timer1 tick display date and time
   timer1.Enabled = true;
   // Position the rich text box to left, under the toolstrip.
   richTextBox1.Top = toolStrip1.Top + toolStrip1.Height;
   richTextBox1.Left = 0;
   resizeRichText();
}

private void timer1_Tick(object sender, EventArgs e)
{
   // Display date and time.
   toolStripStatusDateTime.Text = System.DateTime.Now.ToString();
}
  • Click Save All at this point and run the program to see what you have so far.

    That's all! Congratulations on completing all of the lessons in csharp!