如何增加textboxvalue [英] how to increment textboxvalue
本文介绍了如何增加textboxvalue的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨我想要修改texbox值
喜欢
hi i want incement texbox value
like
gpno=txtbox.text+1;
有可能请帮助我
it is possible pls help me
推荐答案
将文本转换为数值,然后再添加一个
http://msdn.microsoft.com/en-us/library/f02979c7.aspx [ ^ ]
看起来像:
Convert the text to a numerical value, and than add one
http://msdn.microsoft.com/en-us/library/f02979c7.aspx[^]
Would look something like:
Int32 number = new Int32();
if Int32.TryParse(txtbox.text,number) then
{
//it is a number
gpon = number + 1;
}
else
{
//The value is not a number
}
你应该先尝试转换TextBox.Text
属性从其自己的字符串
输入到int
类型:
You should first try to convert theTextBox.Text
property from its ownstring
type toint
type:
int gpno;
if (int32.TryParse(txtbox.Text, out gpno) == false)
{
// handle error: Text content does NOT represent a valid int
}
else
{ // succesful parse, here you may increment the value.
gpno++;
}
是的你可以
yes you can
gpno = Convert.Toint32(txtbox1.text)+1;
这篇关于如何增加textboxvalue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文