Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hi,
 
I want to change "I" to "K" where "I" is a string.
I was trying to convert "I" to int and increment the value to 2 and again convert it to "K" in C#.
I could see the exception.
Please help me in achieving a solution
Posted 24-Apr-13 2:45am
Comments
Member61 at 24-Apr-13 7:48am
   
What exception u r getting?
can you please paste here?
sri4dotnet at 24-Apr-13 7:58am
   
Actually it is related to Excel sheet, data is populated in "I" column but need to be populated in "K" column. I am able to retrieve the column value as "I" and trying to convert it to int and increment to 2 and again convert it to string. so that I can get "K".
 
This is code,
string a = row[1].ToString();
int column = Convert.ToInt32(a);
 
where in a, I get the value as "I"
 
Exception is "Input string was not in a correct format".
ThePhantomUpvoter at 24-Apr-13 8:12am
   
Don't you think that is need-to-know information? Whatever "a" is cannot be converted to an int which is exactly what the error is telling you.
Member61 at 25-Apr-13 0:42am
   
Are u looking for ASCII values?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

string k, i;
k = "1";
i = "2";
i = (Convert.ToInt32(i) + 2).ToString();
k = i;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 565
1 Maciej Los 359
2 Kornfeld Eliyahu Peter 309
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100