Click here to Skip to main content
13,045,657 members (54,028 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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 1:45am
Member61 24-Apr-13 7:48am
What exception u r getting?
can you please paste here?
sri4dotnet 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 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 25-Apr-13 0:42am
Are u looking for ASCII values?

1 solution

Rate this: bad
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;

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 24 Apr 2013
Copyright © CodeProject, 1999-2017
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