输出在每个单词后显示System.Windows.Form.Label



我遇到了用户在文本框(如名称(中输入输入的问题。如果名称是 Jim Bob,它将输出像 Jim System.Windows.Form.Label Bob System.Windows.Form.Label。我搜索了属性选项卡,我正在按照书进行操作,但它们没有与我相同的问题。我在下面添加了一些代码,但我认为这与问题无关。

string output;
output = textBoxPrefT.Text + ". " + textBoxFirstN + " " + textBoxMiddleN + " " + textBoxLastN;
labelOutput.Text = output;
您必须

为所有文本框包含.Text,因此它应如下所示

string output;
output = textBoxPrefT.Text + ". " + textBoxFirstN.Text + " " + textBoxMiddleN.Text + " " + textBoxLastN.Text;
labelOutput.Text = output;

最新更新