我怎样才能使这个方法随机化()¨只生成一个数字? [英] How can I make that ¨method randomize () ¨ only generate a number?

查看:88
本文介绍了我怎样才能使这个方法随机化()¨只生成一个数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看到我正在制作一个谁想成为百万富翁的代码是用Visual Basic语言开展的学校工作,我已经做了2周,但我所做的一切只会产生更多错误(编程时这是正常的) ,寻求帮助的原因是,尽管解决了一些错误仍然存​​在,我的代码是10个表单随机出现(这些包含问题)我想要做的是在关闭另一个之后生成一个,所以试着把所有东西都放在for中但是这个方法在for中随机化,一次把我的10个表格抛给我,我设法让表格不重复但是在回答问题后我无法让它们一个接一个。



我尝试了什么:



把所有东西放在for中

将随机化放入函数中

暂时放入随机化并初始化变量= 0

See I am making a code of "Who wants to be a millionaire" is a school work in Visual basic language, I have been doing it for 2 weeks but everything I do only generates more errors (which is normal when programming), the reason for asking for help is that In spite of solving some errors there is one that persists, my code is that 10 forms appear randomly (these contain the questions) what I want to do is to generate one after closing the other, so try to put everything in a "for "But the method randomize within the for, throws me the 10 forms at once, I managed to make the forms not repeated but I can not get them to be one by one after answering a question.

What I have tried:

Put everything in a "for "
Put "Randomize" in a Function
Put "Randomize" in a while and initialize the variable = 0

推荐答案

这是一个很好的起点(带有示例代码):随机类 - Microsoft [新]文档 [ ^ ]
Here is a great place to start (with sample code): Random Class - Microsoft [new] Documentation[^]


您没有向我们展示代码的相关部分,但您可能想要调用 ShowDialog [ ^ ]而不是显示 [ ^ ]。



显示打开表格并立即返回。 ShowDialog 在表单关闭之前不会返回。
You haven't shown us the relevant parts of your code, but at a guess, you probably want to call ShowDialog[^] instead of Show[^].

Show opens the form and returns immediately. ShowDialog doesn't return until the form has been closed.


这篇关于我怎样才能使这个方法随机化()¨只生成一个数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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