如何在文本框中获取序列号 [英] How to get the serial number in the textbox

查看:206
本文介绍了如何在文本框中获取序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

string DirectoryA = FileDirectory.Text;
string Frame1 = FileNumber.Text;
string img1 = FileType.Text;

FileNumber.Text = FileNumber.Text+ 1;
BMP.Save(DirectoryA + Frame1 + img1);



我有一个名为FileNumber的文本框,它将显示输出数字仅数字1,2,3 ......所以

但它从0,1,1开始,等等

如何才能得到序列号1,2,3所以就这样吧仅包含该文本框中的数字只有单个数字


I have textbox named FileNumber which will show the output like numbers only single number 1,2,3...so on
but it starts with 0,1,1, so on
how can do it to get the serial numbers 1,2,3 so on it contains only numbers in that textbox only single number

推荐答案

因为您试图以STRING类型递增数字。

for fix它,使用此代码:

Because you are trying to increment the numbers in "STRING" type.
for fix it , use this code:
FileNumber.Text = (Convert.ToInt32(FileNumber.Text) + 1).ToString();


https://social.msdn.microsoft.com/Forums/vstudio/en-US/8dda8b46-f3ef-45ff-8e89-4fb8c222deaa / val-in-c?forum = csharpgeneral [ ^ ]


试试这个:



int count = 0;

count = count + 1;

FileNumber.Text = count.ToString();



希望这有帮助。
Try this:

int count = 0;
count = count + 1;
FileNumber.Text = count.ToString();

Hope this helps.


这篇关于如何在文本框中获取序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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