1樓:
函式語法錯了,case後面不用加變數,應該這樣修改:
private sub command1_click()dim a as integer
dim b as integer
text1.text = a
select case a
case is = 1000
print "b = 10000"
case is = 2000
print "b = 20000"
case is = 3000
print "b = 30000"
case else
msgbox "......"
end select
2樓:數學王子他
一是select case語句語法錯誤,二是變數a的賦值來自text1,而不是text1的內容從變數a獲得!(a的值只能恒為0了)
private sub command1_click()dim a as integer
dim b as integer
a = text1.text '變數a的值從text1獲取select case a
case 1000
print "b = 10000"
case 2000
print "b = 20000"
case 3000
print "b = 30000"
case else
msgbox "......"
end select
end sub
vb6.0中select語句使用問題
3樓:匿名使用者
private sub text1_change()select case val(text1.text)case 3500 to 5000
text2.text = 12.6
text3.text = 11.3
case 5001 to 7000
text2.text = 16.3
text3.text = 14.7
case 7001 to 9000
text2.text = 18.8
text3.text = 16.9
case 9001 to 11000
text2.text = 21.5
text3.text = 19.4
case 11001 to 13000
text2.text = 23.8
text3.text = 21.4
case 13001 to 15000
text2.text = 25.7
text3.text = 23.1
case 15001 to 17000
text2.text = 27.4
text3.text = 24.7
case 17001 to 19000
text2.text = 28.9
text3.text = 26
case 19001 to 21000
text2.text = 30.2
text3.text = 27.2
case 21001 to 23000
text2.text = 31.4
text3.text = 28.3
case 23001 to 25000
text2.text = 32.5
text3.text = 29.3
case 25001 to 27000
text2.text = 33.5
text3.text = 30.2
case 27001 to 29000
text2.text = 34.5
text3.text = 31.1
case 29001 to 31000
text2.text = 35.5
text3.text = 32
case is > 31000
msgbox "您輸入的總質量必須大於3500kg和小於31000kg!", 48, "系統提示"
text1.text = ""
text2.text = 0
text3.text = 0
end select
end sub
關於 vb select語句
4樓:紅山人
這個過程是只要符合條件,就執行該條件下的語句。後面符合條件的都不再執行了。這裡,第乙個條件符合。所以只執行b=a+1.故a=6,b=7
vb程式設計建立應用程式用select語句計算分段
select case 語句,根據表示式的值,來決定執行幾組語句中的其中之一。select case 語句示例 本示例使用 select case 語句來判斷變數的值。示例中第二個 case 子句包含了變數值,故只有此區塊內的語句會被完成到。dim number number 8 設定變數初值。se...
VB中判斷語句問題,請教高手,VB中判斷語句問題,請教高手
同上,至少把r pass r2 ex h 的定義和賦值部分貼出來吧 text控制項陣列.兩個text不加任何轉換比較就是逐字比較文字,113和82,8比1大,因此82比113大。用相減的時候vb隱含轉換string為數值,因此正常。所以說vb的隱式轉換害死人,程式設計習慣會變壞。if r2 ex h...
vb語句解釋,詳細點哦,VB的語句解釋
private sub command1 click 定義過程 if trim txtoldpwd.text strmm and txtnewpwd1.text txtnewpwd2.text then txtoldpwd.text是輸入舊密碼,trim函式表示去除前後空格,並且格式成字串格式 co...