Get all ToolStripMenuItem names in a array from MenuStrip

May 29 2018 6:12 AM
1. I want to show running date & time on menuStrip at runtime. Instead of  lblTime.Text = DateTime.Now.ToString("dd/MM/yyyy") + ":" + DateTime.Now.ToString("HH:mm:ss");
2. It's working in static mode. But I want at runtime while am adding ToolStripMenuItem from Database.
3. Pls Help me. 
 
 
System.Windows.Forms.Timer tmr = null;
private void StartTimer()
{
tmr = new System.Windows.Forms.Timer();
tmr.Interval = 1000;
tmr.Tick += new EventHandler(tmr_Tick);
tmr.Enabled = true;
}
void tmr_Tick(object sender, EventArgs e)
{
lblTime.Text = DateTime.Now.ToString("dd/MM/yyyy") + ":" + DateTime.Now.ToString("HH:mm:ss");
//if (lblTime.Text == "11:30:")
//{
// if (oldForm != null)
// oldForm.Close();
// Form reportForm = new BillRpt();
// oldForm = reportForm;
// reportForm.MdiParent = this;
// reportForm.Show();
//}
}
private void MainForm_Load(object sender, EventArgs e)
{
try
{
mainmenu();
StartTimer();
}
catch (Exception)
{ }
}

Answers (1)