Reputation: 113455
I have a char
variable c and a TextBox
textbox1 in my C# application. I want to do this:
textbox1.Text = (c + 2).ToString(); //this doesn't work, sure
For example:
c = 'b';
textbox1.Text = "d";
How can I do this?
Upvotes: 3
Views: 199
Reputation: 2451
Not sure why everyone's casting to int...
textbox1.Text = ((char)(c + 2)).ToString();
Upvotes: 8
Reputation: 81253
Try this -
textbox1.Text = Convert.ToChar((int)c +2).ToString()
Upvotes: -4