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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert string to int

Status
Not open for further replies.

kss444

Programmer
Sep 19, 2006
306
US
Hello all,

I know this should not be hard but I am trying to convert a string ("1.00") to an integer 1.

I have tried Convert.ToInt16(value) and event Convert.ToInt32(value) but they dont seem to work.

The value is coming back from a vb6 interop component

r.field[number].toString()

Anyone have any ideas.
Thanks,

Ordinary Programmer
 
Code:
var i = Convert.ToInt32(r.field[number])
Code:
var i = (int)double.Parse("1.00");
Code:
var i = int.Parse("1.00");

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
I had to do this.

Double useDB = Convert.ToDouble(r.Fields["UseBMforLTLPrice"].Value.ToString());

int useBM = System.Convert.ToInt32(useDB);



Ordinary Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top