Click here to Skip to main content
15,920,383 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How to add integer number from string..?

For Example,

I want to add one number with String values.
rdr("Code") value is "AB"

At end i want to get the result is AB+1,AB+2 like that

Ex:

Dim Cnt as integer = 1

Cnt = rdr("code") + 1 ==> Getting error conversion from string to int

Any problem here...?
Posted

1 solution

If you want to output as "AB+1", "AB+2", then you need to append strings as
C#
for (i=1;i<=5;i++)
{
  String op;
  op = rdr("code") + "+" + i.ToString();
}

You cannot add string "AB" with any integer, as you are doing now.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900