0% found this document useful (0 votes)
40 views

Menustrip: Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains code examples for using MenuStrip, ToolStrip, and StatusStrip controls in Windows Forms applications. The MenuStrip example shows how to handle click events for menu items and includes a method to display a confirmation message before exiting the application. The ToolStrip example demonstrates how to update a ToolStripLabel when a ToolStripButton is clicked. The StatusStrip example uses a Timer to periodically update a ToolStripStatusLabel with the current date.

Uploaded by

Shobha Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Menustrip: Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

The document contains code examples for using MenuStrip, ToolStrip, and StatusStrip controls in Windows Forms applications. The MenuStrip example shows how to handle click events for menu items and includes a method to display a confirmation message before exiting the application. The ToolStrip example demonstrates how to update a ToolStripLabel when a ToolStripButton is clicked. The StatusStrip example uses a Timer to periodically update a ToolStripStatusLabel with the current date.

Uploaded by

Shobha Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

MenuStrip

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace win4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void menuStrip1_ItemClicked(object sender,


ToolStripItemClickedEventArgs e)
{

private void Form1_Load(object sender, EventArgs e)


{

private void tt4_Click(object sender, EventArgs e)


{
if (MessageBox.Show("Really Quit?", "Exit",
MessageBoxButtons.OKCancel) == DialogResult.OK)
{

Application.Exit();

}
}
}
}
ToolStrip

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace win5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void toolStripButton1_Click(object sender, EventArgs e)


{
toolStripLabel1.Text = "Button1 is clicked";
}

private void toolStripLabel1_Click(object sender, EventArgs e)


{

}
}
}
StatusStrip

using System;
using System.Windows.Forms;

namespace StatusBarDateTime
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//Timer Tick Event
private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = DateTime.Today.ToLongDateString();
}
}
}

You might also like