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

時間 2021-06-25 14:58:09

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程式設計的問題

lbound a 取得陣列的下標 ubound a 取得陣列的上標 這樣可以根據資料的上下標確定陣列裡的引數 arr是表示陣列 arr2 4 表示陣列裡有四個引數 step表示是步長,step 1表示在原來的基礎上減1 將timer1的interval屬性設定為100,enabled屬性設定為fal...

VB程式設計的問題

很簡單啊,在窗體上建立兩個按鈕,如下 private subcommand1 click 隨機生成20個正整數 clsdimias integer dims1 asstring dims2 asstring dima 19 asinteger fori 0 to19 a i int rnd 100 ...

VB程式設計問題

if text1.text and not isnumberic text1.text then msgbox a值輸入有誤 含有非數字字元!輸入有誤 text1.text text1.setfocus 第1行與第3行矛盾?text1.text 就是 isnumberic text1.text if...