vb的程式設計問題,偶較笨不要罵我

2021-06-25 14:59:32 字數 868 閱讀 4770

1樓:匿名使用者

private sub command1_click()dim a as integer

dim b as integer

dim c as integer

a = val(text1.text)

b = val(text2.text)

c = val(text3.text)

do while a + b > c and a + c > b and b + c > a

label4.caption = "是三角形"

loop

label4.caption = "不是三角形"

z這樣試試!如果行的話,輸入數字的時候只能輸入整型數字,輸入其他的會出現資料型別錯誤!(這個地方可以進行強制型別轉換或異常處理!)

2樓:匿名使用者

如果條件滿足沒有退出,是死迴圈

private sub command1_click()dim a as integer

dim b as integer

dim c as integer

a = val(text1.text)

b = val(text2.text)

c = val(text3.text)

a = inputbox("")

b = inputbox("")

c = inputbox("")

if a + b > c and a + c > b and b + c > a

label4.caption = "是三角形"

else

label4.caption = "不是三角形"

endif

end sub

VB程式設計的小問題

拆分 千位 int 數字1 1000 百位 int 數字1 100 mod 10十位 int 數字1 10 mod 10各位 數字1 mod 10 逆序 a int 數字1 1000 b int 數字1 100 mod 10c int 數字1 10 mod 10 d 數字1 mod 10 逆序數 d...

VB程式設計的問題,求助高手

private sub text1 keypress keyascii as integer timer1.enabled falseif keyascii 48 or keyascii 58 then 判斷是否數字 if keyascii 32 or keyascii 13 then 不是數字的情...

一個關於vb程式設計的問題,關於VB程式設計的小問題

private sub command1 mousemove button as integer,shift as integer,x as single,y as single dim myvalue randomize myvalue int rnd 1 生成 窗體高度內的一個隨機數值。myva...