[C#] ปุ่ม Message Box style ต่างๆ



โค้ด
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Do you want to save the chages to this file ?",
                "My Application", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("You sholud take shoes off before getting in house",
                "Example 2", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Do you want to keep this picture ?", 
                "Example 3", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Found error from the program", 
                "Example 4", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
        }
    }
}
Previous
Next Post »