Click here to Skip to main content
15,923,789 members
Home / Discussions / C#
   

C#

 
GeneralRe: Lock on static object - Threading Question (long) Pin
Alexander Wiseman9-Jun-06 5:14
Alexander Wiseman9-Jun-06 5:14 
AnswerRe: Lock on static object - Threading Question (long) Pin
LongRange.Shooter9-Jun-06 7:16
LongRange.Shooter9-Jun-06 7:16 
GeneralRe: Lock on static object - Threading Question (long) Pin
Alexander Wiseman9-Jun-06 7:37
Alexander Wiseman9-Jun-06 7:37 
Questionvalidate input Pin
donkaiser9-Jun-06 4:03
donkaiser9-Jun-06 4:03 
AnswerRe: validate input Pin
Dustin Metzgar9-Jun-06 4:24
Dustin Metzgar9-Jun-06 4:24 
GeneralRe: validate input Pin
donkaiser9-Jun-06 4:35
donkaiser9-Jun-06 4:35 
GeneralRe: validate input Pin
Dustin Metzgar9-Jun-06 4:51
Dustin Metzgar9-Jun-06 4:51 
AnswerRe: validate input Pin
Josh Smith9-Jun-06 4:24
Josh Smith9-Jun-06 4:24 
If you're using .NET 2.0 use a TryParse method, such as Int32.TryParse, to see if a string contains a number. If you're using .NET 1.x, then call Int32.Parse or Convert.ToInt32 - but be sure to wrap that call in a try/catch block because if the conversion fails, an exception will be thrown.

Checking if a string contains multiple numbers, like "12 43 656 234523 24", you can use the Split method of the String class to break the input into an array of strings. Then call Parse or TryParse on each string in the array. Beware that calling Split has subtle issues if the input value has multiple spaces in a row. You might want to remove extra spaces, or some other precautionary measure, before parsing the text into numbers.

josh
GeneralRe: validate input Pin
donkaiser9-Jun-06 4:40
donkaiser9-Jun-06 4:40 
GeneralRe: validate input Pin
Josh Smith9-Jun-06 5:15
Josh Smith9-Jun-06 5:15 
QuestionHow to run App from stream ? Pin
hdv2129-Jun-06 3:20
hdv2129-Jun-06 3:20 
AnswerRe: How to run App from stream ? Pin
Josh Smith9-Jun-06 4:00
Josh Smith9-Jun-06 4:00 
Questionsearch in combobox Pin
Mohammed Elkholy9-Jun-06 2:09
Mohammed Elkholy9-Jun-06 2:09 
AnswerRe: search in combobox Pin
Michael Potter9-Jun-06 6:16
Michael Potter9-Jun-06 6:16 
AnswerRe: search in combobox Pin
Drew McGhie9-Jun-06 8:36
Drew McGhie9-Jun-06 8:36 
GeneralRe: search in combobox Pin
Mohammed Elkholy11-Jun-06 8:21
Mohammed Elkholy11-Jun-06 8:21 
QuestionActive Directory [modified] Pin
pooja_a289-Jun-06 1:19
pooja_a289-Jun-06 1:19 
AnswerRe: Active Directory [modified] Pin
Corinna John9-Jun-06 1:44
Corinna John9-Jun-06 1:44 
GeneralRe: Active Directory Pin
pooja_a2813-Jun-06 2:17
pooja_a2813-Jun-06 2:17 
QuestionRegarding Windows Service in C# Pin
_mubashir9-Jun-06 0:27
_mubashir9-Jun-06 0:27 
GeneralRe: Regarding Windows Service in C# [modified] Pin
Le centriste9-Jun-06 4:42
Le centriste9-Jun-06 4:42 
QuestionEditing ListViewSubItem in C# Pin
peshawarcoder8-Jun-06 23:59
peshawarcoder8-Jun-06 23:59 
AnswerRe: Editing ListViewSubItem in C# Pin
Corinna John9-Jun-06 1:46
Corinna John9-Jun-06 1:46 
QuestionSqlCommand.parameterCollection ?? Pin
maaran8-Jun-06 23:54
maaran8-Jun-06 23:54 
AnswerRe: SqlCommand.parameterCollection ?? Pin
Colin Angus Mackay9-Jun-06 0:04
Colin Angus Mackay9-Jun-06 0:04 

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.