Message Box
In this post we will learn how to use Message box in c# windows form.
First open Visual studio and select Visual C# > Window > Windows Forms Application like below image.
Now click Ok Button and you can like below image type interface.Now click on the toolbox and choose button and change the button text . My button text name is Show Msg Box as you can see like below image.
After complete Above process now double click on the Show Msg Box and write few code like below image.
Code :-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace msgbox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("I'm a Message box");
}
}
}
After write that code, click on the Start and see output like this:-
OUTPUT
Comments
Post a Comment
If you any doubt of any topic then you can comment me.