關於VB的小問題,乙個關於VB的小問題

時間 2022-07-25 10:00:15

1樓:匿名使用者

有這樣幾個地方:

1.combo1的具體作用我沒看出來,我去掉了。

2.dim as integer這一句明顯錯了,去掉

3.cmbrnd我感覺拼錯了,我改成了cmdrnd

4.新增了全域性變數i。

======

修改完畢的完整**如下。

option explicit

dim i as integer

private sub cmdrnd_click()

i = int(rnd * 100)

txtdisplay.setfocus

end sub

private sub cmdcomp_click()

dim t1 as integer

if val(txtdisplay.text) > i then

t1 = msgbox("大了", vbokonly + vbexclamation, "系統提示")

elseif val(txtdisplay.text) < i then

t1 = msgbox("小了", vbokonly + vbexclamation, "系統提示")

else

t1 = msgbox("你真聰明,猜對了!", vbokonly + vbinformation, "系統提示")

end if

txtdisplay.setfocus

end sub

private sub cmdquit_click()

endend sub

private sub form_load()

randomize

end sub

2樓:

private sub cmbrnd_click()rndomize

i = int(rnd * 100)

txtdisplay.setfocus

end sub

'(rndomize 這句是初始化隨機種子,如果沒有這句的話,那麼每次產生的隨機數都是一樣的!)

3樓:匿名使用者

你要把i定義成全域性變數

vb 的一些不懂得地方,關於vb的小問題

第一題,你是對的,只有a是vb不允許的,其他的都可以。第二題,是not and or三個的優先順序,三個中,not最高,and次之,or最低,所以用括號形式就是 not a c or 4 c b 2 and b a c 結果是true還是false你就明白了。a c是真,not a c才是假。第三題...

關於vb的問題

僅供參考 private sub command1 click dim warning as string dim sql as string warning 輸入有效性判斷。if textuser then warning warning 使用者名稱 if textpassword then wa...

vb多年的問題,vb乙個多年的問題。。

private sub form keydown keycode as integer,shift as integer if keycode vbkeya then timer1.enabled true end sub private sub form keyup keycode as inte...