【问题标题】:Getting a value out of Textbox从文本框中获取值
【发布时间】:2012-06-01 18:19:14
【问题描述】:

我知道问这个问题很愚蠢,但我似乎无法从我的文本框中为 Windows 8 Metro 应用程序添加额外的 Value(int)。已经尝试了几个小时,感觉很愚蠢,有人帮帮我。谢谢

int test = textboxSharedTotal.GetValue;
int test = int.Parse(textboxSharedTotal);
int test = int.Parse(textboxSharedTotal.Text);

【问题讨论】:

  • 您能否提供更多详细信息和您尝试过的代码?
  • 我认为您没有在文本框中设置任何内容,因此没有任何价值。检查绑定。

标签: c# windows-8 windows-runtime microsoft-metro


【解决方案1】:

int test = int.Parse(textboxSharedTotal.Text);

应该可以。没有更多细节,很难为您提供帮助。如果此文本框出现在对话框中,但您想提取值并在主窗体/应用程序中引用它,则需要在对话框函数调用之外声明 int test 并将其作为引用字符串传递。然后你可以设置它 = int.Parse(textboxSharedTotal.Text);并且在用户关闭对话框后仍然具有该值。

如果没有更多细节,我不知道这是否是你的问题。

【讨论】:

  • err 我的意思是把它作为 ref int 而不是 ref string 传入
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-03-19
  • 2012-02-11
  • 2016-12-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-22
相关资源
最近更新 更多