How can I look for ASCII values in my DataGrid
-
Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.
Mvelo Walaza Developer Telkom SA
-
Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.
Mvelo Walaza Developer Telkom SA
What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Christian Graus wrote:
All non blank strings are arguably ASCII values.
Not quite - if the language in use is not written in the Roman script (Cyrillic, Indian scripts, CJK, etc) he may be right in considering ASCII values invalid.
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Hi, I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns: if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "") error_per_row = error_per_row +"Error: Invalid characters on " + field_name; Can anyone help to check for ASCII values.
Mvelo Walaza Developer Telkom SA
Hey There is lot of way for that, get string and pass to char, then check ur ASCII is found in the grid cell value. more info: please search in web.
Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com
-
What do you mean by ASCII values ? All non blank strings are arguably ASCII values. Why not parse your data source and any input instead of doing this all the time ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I'm trying to say that, if the datagrid rows contains any ASCII values/data it should display an error (add it to error_per_row). I would like code to check if any ASCII data exists in the row.
Mvelo Walaza Developer Telkom SA
OK - so you want to throw an error no matter what ? If the string is empty, or if it's not ? Or, can you tell me what you mean by ASCII ? Whatever you mean, and it's far from clear, you can do it with a regex.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
OK - so you want to throw an error no matter what ? If the string is empty, or if it's not ? Or, can you tell me what you mean by ASCII ? Whatever you mean, and it's far from clear, you can do it with a regex.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
I'm trying to say: if while looping through the data in the datagrid I come across data that is not normal alphabets (written in ASCII code), add "Invalid characters" to the 'error_per_row' vaiable.
Mvelo Walaza Developer Telkom SA
OK, well you failed utterly to say that. You can do that with a regex, easy enough. If you don't know how to use regular expressions, I'd recomend downloading the program 'expresso'
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )