Error Provider Window Application in C# .Net
In this blog
we will know about how to use error provide control in window application
Step 1:- Open
visual Studio any versions have you installed your machine. I have VS2012
Click New project open new folder look like below
Step2:- Enter your application Name and click OK.
Step 3:- Design your window application drag and drop one textbox and one buttons and one label and errorProvider. Click button and add source codes.
Source code screenshot below
CODING PART START BELOW
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;
using System.Diagnostics;
using System.ComponentModel;
using System.Text;
namespace Error2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "krishna")
{
errorProvider1.Clear();
MessageBox.Show("This is
Valid Data");
}
else
{
errorProvider1.SetError(textBox1,"please
enter correct data");
MessageBox.Show("please enter
correct data");
errorProvider1.BlinkStyle = ErrorBlinkStyle.BlinkIfDifferentError;
}
}
}
}
Outputs Below
screenshots
Final Output Here
Thank You
for Reading.. :) Keep Programming.
Csharpcorner my articles link here
c-sharpcorner.com |
No comments:
Post a Comment
Please Comment Your Valuable Feedback....