When ever we create a windows application on that case in some places we needed to restrict user for entering some value or need to display error message box with error icon and ok button. So in this article i will show you how you can display a error message box in windows application using c# and VB.Net
If you are using try catch block on that case also you can use this message box to display the message box.
Some of my previous articles are as follows:
so here is the code for this article.
Now run the demo for output
If you are using try catch block on that case also you can use this message box to display the message box.
Some of my previous articles are as follows:
How
to implement windows authentication in asp.net mvc , How
to create a Xml Document Programmatically Using C#.Net .
You may also lie some eBooks to download: Free
eBook - Professional ASP.NET 4 in C# and VB , Professional
ASP.NET 4.5 in C# and VB - Free download eBooks .
so here is the code for this article.
C#.Net
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 ErrorMesssage
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void btnerror_Click(object
sender, EventArgs e)
{
//Suppose
we have error message "Sorry Please enter number only
MessageBox.Show("Sorry Please enter number only", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
|
VB.Net
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Namespace ErrorMesssage
Partial Public Class Form1
Inherits
Form
Public
Sub New()
InitializeComponent()
End Sub
Private
Sub btnerror_Click(ByVal
sender As Object,
ByVal e As EventArgs)
'Suppose
we have error message "Sorry Please enter number only
MessageBox.Show("Sorry Please enter number only", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Sub
End Class
End Namespace
|
now click on button to display the message.
0 comments:
Please let me know your view