VB.NET自动增量 [英] VB.NET AUTO INCREMENT

查看:92
本文介绍了VB.NET自动增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我说有一个名为(Number)的标签,然后是一个文本框和按钮(保存)



如何将文本框中的数字增加1?



我的意思是如果我点击按钮保存文本框中的数字1它将增加1然后如果我不保存它并关闭程序我留下的最后一个号码仍将保留(如果它不像我之前所说的那样用于保存。)



有人可以给我一个示例代码吗vb.net?比你

Let Say i have a form with label named(Number) then a textbox and Button(Save)

How to Increment a number in a textbox by 1?

I mean if i click the button save the number "1" in the textbox it will increment by 1 then if i don't save it and close the program the last number i left will be still remain (if it is not used for saving like what i have said earlier.)

Can someone give me a sample code for this in vb.net? Than You

推荐答案

你需要将文本解析为某种整数类型。例如:

You need to parse the text to some integer type. For example:
int value;
if (int.TryParse(myTextBox.Text, out value))
   myTextBox.Text.Text = (++value).ToString();
else
   // do something when the text cannot be parsed as integer





-SA


这篇关于VB.NET自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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