Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
Questionlistbox Pin
netJP12L18-Jul-08 19:40
netJP12L18-Jul-08 19:40 
AnswerRe: listbox Pin
Mbah Dhaim19-Jul-08 0:58
Mbah Dhaim19-Jul-08 0:58 
AnswerRe: listbox Pin
Luc Pattyn19-Jul-08 1:40
sitebuilderLuc Pattyn19-Jul-08 1:40 
QuestionFile Expire ? Pin
sitnet18-Jul-08 19:02
sitnet18-Jul-08 19:02 
AnswerRe: File Expire ? Pin
N a v a n e e t h18-Jul-08 19:58
N a v a n e e t h18-Jul-08 19:58 
QuestionRe: File Expire ? Pin
sitnet18-Jul-08 23:42
sitnet18-Jul-08 23:42 
GeneralRe: File Expire ? Pin
Guffa19-Jul-08 1:12
Guffa19-Jul-08 1:12 
QuestionError provider in C#(Win forms) Pin
paytam18-Jul-08 16:52
paytam18-Jul-08 16:52 
Hi all
I use an error provider in my win form in order to validate some text
boxes value.
My problem is this:if the user input something wrong then the error
provider shows him a
notification,It is logical,but when user correct the value the error
notification is still visible to him
and the user think that he made a mistake again.The same problem is
happened in DatagridView.
what should I do to prevent this?(the error provider disappeared when
user correct his value when he entered)
the following code is a piece of my code which I use:

private void txtName_Validating(object sender,
System.ComponentModel.CancelEventArgs e)
{
if (!IsNameValid())
{
e.Cancel = true;
}
}

private bool IsNameValid()
{
txtName.Text = txtName.Text.Trim();
if (txtName.Text == string.Empty)
{
erp1.SetError(txtName, "Name must not be blank.");
return false;
}
else
{
erp1.SetError(txtName, "");
return true;
}
}

---------------------DataGridView-----------------
void DataGridView1CellValidating(object sender,
DataGridViewCellValidatingEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].HeaderText=="Input")
{
char[] chArray=e.FormattedValue.ToString().ToCharArray();
bool flag=false;
foreach(char ch in chArray){
if(!Char.IsDigit(ch)){

flag=true;
e.Cancel=true;
break;
}
if(flag==true){
dataGridView1.Rows[e.RowIndex].ErrorText = "Invalid Product
Image";
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText =
"The file name must end with '.gif'.";
}
else
{
dataGridView1.Rows[e.RowIndex].ErrorText = "";

dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText
="";

}
}

}
}
AnswerRe: Error provider in C#(Win forms) Pin
William Ten Broek18-Jul-08 21:53
William Ten Broek18-Jul-08 21:53 
QuestionPath Pin
nelsonpaixao18-Jul-08 15:21
nelsonpaixao18-Jul-08 15:21 
AnswerRe: Path Pin
Scott Dorman18-Jul-08 18:25
professionalScott Dorman18-Jul-08 18:25 
AnswerRe: Path Pin
Scott Dorman18-Jul-08 18:36
professionalScott Dorman18-Jul-08 18:36 
QuestionDesign Form inside Form Pin
nelsonpaixao18-Jul-08 14:31
nelsonpaixao18-Jul-08 14:31 
AnswerRe: Design Form inside Form Pin
Luc Pattyn18-Jul-08 14:34
sitebuilderLuc Pattyn18-Jul-08 14:34 
GeneralRe: Design Form inside Form Pin
nelsonpaixao18-Jul-08 15:15
nelsonpaixao18-Jul-08 15:15 
QuestionHow does one get the name of a variable which is passed to a method? Pin
jeffb4218-Jul-08 12:42
jeffb4218-Jul-08 12:42 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
Mbah Dhaim18-Jul-08 13:03
Mbah Dhaim18-Jul-08 13:03 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
jeffb4218-Jul-08 13:19
jeffb4218-Jul-08 13:19 
AnswerRe: How does one get the name of a variable which is passed to a method? Pin
Luc Pattyn18-Jul-08 13:11
sitebuilderLuc Pattyn18-Jul-08 13:11 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
jeffb4218-Jul-08 13:24
jeffb4218-Jul-08 13:24 
AnswerRe: How does one get the name of a variable which is passed to a method? Pin
Guffa18-Jul-08 13:24
Guffa18-Jul-08 13:24 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
Luc Pattyn18-Jul-08 13:33
sitebuilderLuc Pattyn18-Jul-08 13:33 
JokeRe: How does one get the name of a variable which is passed to a method? Pin
PIEBALDconsult18-Jul-08 13:52
mvePIEBALDconsult18-Jul-08 13:52 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
Luc Pattyn18-Jul-08 14:06
sitebuilderLuc Pattyn18-Jul-08 14:06 
GeneralRe: How does one get the name of a variable which is passed to a method? Pin
jeffb4218-Jul-08 14:11
jeffb4218-Jul-08 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.