在TextBox插入一个整数值 [英] Inserting an integer value in a TextBox

查看:132
本文介绍了在TextBox插入一个整数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示在我的C#Windows文本框的整数值窗体应用程序(GUI)。
我可以有一个Int32值。我找不到像一个TextBox的需要int类型的容器。文本框只接受字符串。我如何强制类型转换?

I need to show an integer value in a TextBox in my C# Windows Forms application (GUI). I have an int32 value available. I could not find a container like a TextBox that takes int values. The TextBox only accepts Strings. How do I type cast?

推荐答案

在.NET中一切都可以转化为以某种方式字符串或其他使用的ToString()方法。

Everything in .NET can be transformed to a string in one way or another by using the "ToString()" method.

示例

int x = 5;
string y = x.ToString();

这篇关于在TextBox插入一个整数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆