Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: converting string to integer in c#??


Message #1 by "Yu, Kevin" <kyu@N...> on Tue, 4 Dec 2001 11:52:15 -0500
I'm on this thread late, but here's my two cents.

If you have a string let's say "124" and you want it to be an int object:

C#:
int myInt = Convert.ToInt32("124");

VB:
int myInt = Convert.ToInt32("124")

If your string has alphanumeric you would not be able to use this
method...you'd first have to ensure that the string is indeed an integer.
You could parse out the alphas, but it depends on your goal.

Tim

-----Original Message-----
From: Louis T Kklauder Jr [mailto:lklauder@w...] 
Sent: Tuesday, December 04, 2001 10:37 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: converting string to integer in c#??


What string?

-----Original Message-----
From: Yu, Kevin [mailto:kyu@N...] 
Sent: Tuesday, December 04, 2001 11:52 AM
To: ASPX_Professional
Subject: [aspx_professional] converting string to integer in c#??

I try to cast it, but vs.net gives me error says "can't convert string to
int", anyone?

Kevin

---
VBug Winter Conference 2001 

Make no mistake - there's a great learning curve 
for developers moving from COM to .NET.  So why 
would you want to be a pioneer and cross the bridges 
first?  Attend the .NET Developer's Conference 
(28th to 30th November 2001) In London and realise 
the benefits of adopting the technology early.  By 
attending you'll understand the key challenges and 
be left with a thorough understanding of the major 
.NET fundamentals.   If you're already working 
with .NET this is a must-attend event.  

http://www.vbug.co.uk/redirect.asp?url=39&id=17

---
You are currently subscribed to 
aspx_professional as: lklauder@w...
$subst('Email.Unsub')


---
VBug Winter Conference 2001 

Make no mistake - there's a great learning curve 
for developers moving from COM to .NET.  So why 
would you want to be a pioneer and cross the bridges 
first?  Attend the .NET Developer's Conference 
(28th to 30th November 2001) In London and realise 
the benefits of adopting the technology early.  By 
attending you'll understand the key challenges and 
be left with a thorough understanding of the major 
.NET fundamentals.   If you're already working 
with .NET this is a must-attend event.  

http://www.vbug.co.uk/redirect.asp?url=39&id=17

---
You are currently subscribed to 
aspx_professional as: timh@i...
$subst('Email.Unsub')

  Return to Index