求VB題的答案,請高手指教

2022-10-09 05:36:23 字數 1223 閱讀 4214

1樓:匿名使用者

'text1為被除數 text2為除數

private sub command1_click() '執行除法運算

text3 = val(text1.text) / val(text2.text) '商

text4 = val(text1.text) \ val(text2.text) '整數商

text5 = val(text1.text) mod val(text2.text) '求餘

end sub

2樓:匿名使用者

要準備5個文字,5個標籤,乙個按紐,注意被除數可以為0 但除數不能為0,**如下

option explicit: dim a as long, b as long, c as long, d as long

private sub command1_click()

a = int(text1.text): b = int(text2.text)

c = int(text1.text): d = int(text2.text)

if b <> 0 then text4.text = a \ b

if b = 0 then msgbox "除數不能為0"

if val(text2.text) <> 0 then text3.text = val(text1.text) / val(text2.text)

if val(text2.text) = 0 then msgbox "除數不能為0"

if d <> 0 then text5.text = c mod d

if d = 0 then msgbox "除數不能為0"

end sub

private sub form_load()

text1.text = ""

text2.text = ""

text3.text = ""

text4.text = ""

text5.text = ""

label1.caption = "被除數:"

label2.caption = "除數:"

label3.caption = "商(/):"

label4.caption = "整數商(\):"

label5.caption = "餘數商(mod):"

command1.caption = "【執行除法運算】"

end sub

SQL查詢請高手指教,SQL 查詢 請高手指教

select 部門名稱,count 使用者id max 使用者登陸時間 from 登陸表 a join 關係表 b on a.使用者id b.使用者id join 部門表 c on b.部門id c.部門id where 使用者id 1 group by 使用者id,部門id with rollup...

電腦中毒請高手指教,電腦中毒,請高手指教!

安全模式重灌主防 你有360的話,急救箱用用看,微點報錯了得話就比較麻煩了,估計是病毒直接破壞了防毒防禦,建議重灌。重灌之後除了系統盤之外不要開啟,安裝防毒軟體,全面防毒,ok了再正常使用。你用用360急救箱,殺完毒之後,還不放心就重灌一下系統 安裝江民防毒,並且在安裝時勾選安裝前先掃瞄,這樣安裝之...

電腦公升級,請指教,想公升級電腦,請高手指教!

記憶體加到1g 顯示卡換到agp的6800gt就可以玩玩永恆之塔還有實況20096600gt是pcie橋接過來的,發熱大,容易壞你的機器電源如果不夠建議換乙個 如果連額定250w都達不到必須換,最好額定300w以上 512m ddr400 80元左右6800gt 256m 256bit的 280 3...