In this tutorial we will learn how to use message boxes.
We need a button.
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 Message_Box
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DialogResult clicked;
clicked = MessageBox.Show("Do you realy want to exit","Warning",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
if (clicked == DialogResult.Yes)
this.Close();
}
}
}