This article will show you how you can display message with
warning icon in windows application using c#.net.
Some of my previous articles are as follows: Stylish
ToolStrip Button Control With Image and Text Control In Windows Application
Using C#.Net, No
of Days Between Two Dates By Using TimeSpan In Windows Application In C#.Net
and VB.Net, Validate
Directory Exist or Not in C#.Net In Windows Application, Image
Save In XML and Load XML Bitmap Image File in Windows Application Using C#.Net,
How
to Save Record in XML File and Read XML to Display in DataGridview Using C#.net
in Windows Application, How
to Add HyperLink and Retrieve Row Value on Link Click in DataGridView #,
Windows application, How
to Add Button Control and Retrieve Row Value on Button Click in DataGridView
Using C#.Net, Windows Application.
So for this article first we will create a new windows
application and add the below code.
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
if
(txtname.Text == "")
{
MessageBox.Show("Please enter name.", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
}
}
}
|
In above code just check the messagebox. This pierce of code
will display message with warning icon.
Now we have done run the application to check the output.
0 comments:
Please let me know your view