Saturday, March 31, 2012

String to integer conversion

Hello!

Class int has a method for conversion numeric values to strings (ToString() method). Is there any similar method or function, which converts a string into Int32 type?

Cheers!static method System.Int32.Parse()
Thanks!
Hello!

I tried to use the method you gave me, but got an error message: "System.FormatException: Input string was not in a correct format."
Maybe there is any special way I should use it?

Here's how I do it:


void Fill_End_Day(int auto, int aasta, int kuu, int paev) {
autorent.broneering wsProxy = new autorent.broneering();
System.Data.DataSet ds;
ds = wsProxy.JargmineHyiv(auto, aasta, kuu, paev);
int i;
for (i=paev; i<System.Int32.Parse(ds.Tables[0].Rows[0]["paev"].ToString()); i++)
DropDownList7.Items.Add(i.ToString());
}

Is there something wrong with it?

Cheers.
c# doesn't have cInt()?
I'm afraid it doesn't. Maybe there is some similar function, but I can't even assume in which class I should seek for it.
Sorry, it works now! It should have worked from the beginning, but there has been a stupid mistake in another palce.
Thank you!

0 comments:

Post a Comment