Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
Question[Message Deleted] Pin
bruno cortona4-Sep-05 22:14
bruno cortona4-Sep-05 22:14 
AnswerRe: VS .NET 2003 hangs on NullReferenceException Pin
Andy Brummer5-Sep-05 4:22
sitebuilderAndy Brummer5-Sep-05 4:22 
GeneralRe: VS .NET 2003 hangs on NullReferenceException Pin
bruno cortona5-Sep-05 5:22
bruno cortona5-Sep-05 5:22 
Questionunsafe code Pin
Sheel Gohe4-Sep-05 22:00
Sheel Gohe4-Sep-05 22:00 
QuestionC# DLL in VC++ / MFC Pin
Anonymous4-Sep-05 21:40
Anonymous4-Sep-05 21:40 
AnswerRe: C# DLL in VC++ / MFC Pin
Anonymous5-Sep-05 2:24
Anonymous5-Sep-05 2:24 
Questiondetermining if a string contains an int Pin
Tyrus1824-Sep-05 21:04
Tyrus1824-Sep-05 21:04 
AnswerRe: determining if a string contains an int Pin
Guffa4-Sep-05 21:16
Guffa4-Sep-05 21:16 
The easiest way is to put a try...catch around the conversion:

try {
	num = int.Parse(str);
	ok = true;
} catch {
	ok = false;
}


Exceptions are quite expensive, though, so it's more efficient to validate the string before you convert it. You can use the Regex class to check if the string only contains digits, for an example.

---
b { font-weight: normal; }

AnswerRe: determining if a string contains an int Pin
Alsvha4-Sep-05 21:17
Alsvha4-Sep-05 21:17 
Answer[Message Deleted] Pin
Mark Greenwood4-Sep-05 21:25
Mark Greenwood4-Sep-05 21:25 
Questiona question about config file for windows service program Pin
Bright Zhang4-Sep-05 19:23
Bright Zhang4-Sep-05 19:23 
AnswerRe: a question about config file for windows service program Pin
Andy Brummer4-Sep-05 20:39
sitebuilderAndy Brummer4-Sep-05 20:39 
GeneralRe: a question about config file for windows service program Pin
Bright Zhang4-Sep-05 21:02
Bright Zhang4-Sep-05 21:02 
QuestionHook the tab key on Window Form Pin
Duong Tien Nam4-Sep-05 17:32
Duong Tien Nam4-Sep-05 17:32 
AnswerRe: Hook the tab key on Window Form Pin
Luis Alonso Ramos4-Sep-05 20:04
Luis Alonso Ramos4-Sep-05 20:04 
AnswerRe: Hook the tab key on Window Form Pin
Sheel Gohe4-Sep-05 20:08
Sheel Gohe4-Sep-05 20:08 
GeneralRe: Hook the tab key on Window Form Pin
Duong Tien Nam4-Sep-05 20:11
Duong Tien Nam4-Sep-05 20:11 
GeneralRe: Hook the tab key on Window Form Pin
Duong Tien Nam4-Sep-05 21:04
Duong Tien Nam4-Sep-05 21:04 
QuestionAcceptButton for a UserControl? Pin
WetRivrRat4-Sep-05 16:33
WetRivrRat4-Sep-05 16:33 
AnswerRe: AcceptButton for a UserControl? Pin
Luis Alonso Ramos4-Sep-05 16:59
Luis Alonso Ramos4-Sep-05 16:59 
Questionruler control Pin
azusakt4-Sep-05 16:32
azusakt4-Sep-05 16:32 
AnswerRe: ruler control Pin
Christian Graus4-Sep-05 16:35
protectorChristian Graus4-Sep-05 16:35 
AnswerRe: ruler control Pin
Mohamad Al Husseiny4-Sep-05 16:36
Mohamad Al Husseiny4-Sep-05 16:36 
GeneralRe: ruler control Pin
azusakt4-Sep-05 16:42
azusakt4-Sep-05 16:42 
QuestionI darg-drop item to a WebBrowser control Pin
Member 19785854-Sep-05 15:31
Member 19785854-Sep-05 15:31 

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.