【发布时间】:2012-07-20 22:16:48
【问题描述】:
我的 C# 应用程序中有一个 char 变量 c 和一个 TextBox textbox1。我想这样做:
textbox1.Text = (c + 2).ToString(); //this doesn't work, sure
例如:
c = 'b';
textbox1.Text = "d";
我该怎么做?
【问题讨论】:
我的 C# 应用程序中有一个 char 变量 c 和一个 TextBox textbox1。我想这样做:
textbox1.Text = (c + 2).ToString(); //this doesn't work, sure
例如:
c = 'b';
textbox1.Text = "d";
我该怎么做?
【问题讨论】:
textbox1.Text = ((char)(((int)c) + 2)).ToString();
【讨论】:
不知道为什么每个人都选择 int...
textbox1.Text = ((char)(c + 2)).ToString();
【讨论】:
试试这个 -
textbox1.Text = Convert.ToChar((int)c +2).ToString()
【讨论】: