in this TextBox value is '0' then it show the error give
a validation control on TextBox....
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Oct 16, 2012, 3:03 AM EDT
check here for error provider
http://www.dotnetperls.com/errorprovider
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 16, 2012, 5:41 AM EDT
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 WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (Convert.ToBoolean(textBox1.Text == "0"))
{
errorProvider1.SetError(textBox1, "You have entered 0");
}
else
{
errorProvider1.Clear();
}
}
}
}
Thanks
sri40 reputationPosted Oct 16, 2012, 9:05 PM EDT
errorProvider1.SetError(textBox1, "You have entered 0");
sri40 reputationPosted Oct 16, 2012, 9:18 PM EDT
errorProvider1 is does not exist....
sri40 reputationPosted Oct 16, 2012, 9:33 PM EDT
Thanks.