Click here to Skip to main content
15,891,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a project on object detection
i want to ask...
how to convert data string to char
C#
label1.Text = string.Format("Number of Circle :{0}", circleCount);
label4.Text = string.Format("Number of Rectangular :{0}", rectangularCount);
label8.Text = string.Format("Number of Rhombus :{0}", rhombusCount);

if the label1 worth 1 then i want to convert to char a
if the label4 worth 1 then i want to convert to char b
if the label8 worth 1 then i want to convert to char c

how?
sorry im newbie, and bad english
Posted
Updated 29-Nov-14 23:47pm
v3
Comments
Afzaal Ahmad Zeeshan 30-Nov-14 5:50am    
Where are the characters and what do you mean by worth?
BillWoodruff 30-Nov-14 15:54pm    
Since Label content is not directly editable at run-time, and, apparently, you create the Labels, why can't you keep track of the values ("worth") ?

If you mean you want to convert the value of your circleCount, rectangularCount,and rhombusCount to characters, then that's pretty simple:

C#
char c1 = (char) 'a' + circleCount;
char c2 = (char) 'b' + rectangularCount;
char c3 = (char) 'c' + rhombusCount;


If that isn't what you mean, you need to explain in much better detail!
 
Share this answer
 
Ok thanks for solution...
my project is object detection base on object shape with manipulator robot...
about my question i want to send data from c# to vb6 with socket udp(c# is client and vb6 is server).
if circle detected then Number of Circle :{1}" then i want to send circle :1 = A to vb6, because in vb6 i accept data with char.
Therefore i need convert string to char...
Thanks ,,,
sorry for my bad english
 
Share this answer
 
v2
Comments
BillWoodruff 30-Nov-14 23:43pm    
Please post edits, and new content, in your original post, rather than as a "solution."

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