Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Casting strings

Status
Not open for further replies.

Pyramus

Programmer
Joined
Dec 19, 2001
Messages
237
Location
GB
Isn't it possible in .NET to cast strings to ints and longs? I'm trying and getting compile errors.
 
Have you tried things along the line of:

Code:
int.Parse(yourString);
 
or:
Code:
int i = Convert.ToInt32(yourString);
Don't forget your try...catch block to prevent format exceptions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top