vb系統中,在兩個文字框中輸入範圍,計算該範圍中3的倍數有幾個

時間 2022-05-22 11:30:11

1樓:匿名使用者

private sub command1_click()if val(text1.text) > val(text2.text) then t = text2.

text: text2.text = text1.

text: text1.text = t

for i = val(text1.text) to val(text2.text)

if i mod 3 = 0 then a = a + 1next i

label1.caption = val(text1.text) & "到" & val(text2.text) & "的範圍中3的倍數的個數為" & a

end sub

2樓:風雨兼程

private sub command1_click()dim a&, b&, s$

a = int(val(text1) - 0.1) + 1: b = int(val(text2))

for i = a to b step (b - a) / abs(a - b)

if i mod 3 = 0 then sum = sum + 1: s = s & i & ";"

next

print "有" & sum & "個"; send sub

3樓:我是股神帝

範圍a-範圍b

dim c as integer

for i=a to b

if i mod 3 = 0 then c=c+1next i

在VB中,如何使文字框能夠使輸入多行文字

在vb中,設定文字框的multiline 屬性為true,就能使使文字框能夠輸入多行文字。multiline 屬性 返回或設定一個值,該值指示 textbox 控制元件是否能夠接受和顯示多行文字。在執行時是隻讀的。 中原一點紅先生 僅僅設定multiline屬性是沒用的。還要在輸出的時候用控制符設定...

vb中我想在文字框中輸入某個數,然後按enter鍵之後,呼叫function

聽不清啊 private sub command1 click dim x as long x text1 yes true for i 2 to sqr x if x mod i 0 then yes false exit for end if next i if yes then label1....

VB將文字框中的漢字按拼音排序

首先將漢字轉為ascii碼陣列,然後對ascii碼陣列排序。再將ascii碼陣列轉換為字元,大功告成了。以下 經測試完全正確。dim lasc j as long private sub command1 click dim i as long,j as long,k as long dim r a...