Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have two varible
string tabtype=,7,11;

int Company=tabtype;


how to convert string value to int
Posted
Updated 30-Oct-14 1:25am

Hi Sanjay,

In ypur tabtaype you have a comma seperated string. So after splitting you will get an array of integers. Like:
C#
string tabtype = ",7,8,11";
int[] nums = Array.ConvertAll(tabtype.Remove(0, 1).Split(','), int.Parse);


You now have an array of Company. Loop this and use these ids.

Hope this helps !! :) :)



Regards,
Praneet
 
Share this answer
 
v2
Comments
sanjaysgh 30-Oct-14 7:46am    
Its not working
[no name] 30-Oct-14 7:49am    
What is your string ? Paste it here
[no name] 31-Oct-14 1:59am    
Check your data before answering
sanjaysgh 30-Oct-14 7:54am    
,7,8,11
sanjaysgh 30-Oct-14 7:55am    
and How to loop it
C#
string tabtype = "7,11";

string[] num = tabtype.Split(',');

int a = int.Parse(num[0]);
 
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