最近学习c#需要用到登录的4位数验证码就使用了这样一个方法
//定义一个字符串
string code;
//初始化随机对象
Random ran=new Random();
//调用.next()方法
code=ran.Next(0000,9999).Tostring();
//在你想要的控件中显示
lblshow.Text=code;
最近学习c#需要用到登录的4位数验证码就使用了这样一个方法
//定义一个字符串
string code;
//初始化随机对象
Random ran=new Random();
//调用.next()方法
code=ran.Next(0000,9999).Tostring();
//在你想要的控件中显示
lblshow.Text=code;