如题所述
ææ¯æ¢å«çï¼æåç»æå§
é¦å 建ç«ä¸ä¸ªcommand1 ç¶ååªåå¤å¶ ç³»ç»æ示说已ç»æä¸ä¸ªCOMMAND1 æ¯å¦è¦å»ºç«æ§ä»¶æ°ç»ï¼
ä½ ç¹å»æ¯ è¿æ ·éå¤9次 åå«æcaption该æ0å°9 ç¶å建ç«command2 æ¹æ³åä¸,caption为 +-*/ ç¶åæ¯ command3 captionæ¯=
ç¶åè¾å ¥ä»£ç ,é¦å å¨éç¨éçå½dim shu1,shu2
dim suanfu as string
private sub command1(index)_click
text1.text=text1.text & commmand1(index).capton
end sub
command2é è¾å ¥
shu1=text1.text
suanfu=text1.text & command(index).capiton
text1.text=""
end sub
command3éè¾å ¥
shu2=text1.text
selece case suanfu
case "+"
text1.text=shu1+shu2
case "-"
text1.text=shu1-shu2
case "*"
text1.text=shu*shu2
case "/"
if shu2=0 then
msgbox "åæ¯ä¸è½ä¸º0"
else text1.text=shu1/shu2
end if
end select
end sub
è¿æ¯æç®åç计ç®å¨ç å¦æè¿éè¦ä»ä¹åè½ æä¹å¯ä»¥åè¯ä½ ç æå¦VB3个æäº ç¥æå°æ æ以æ³æ¥ç §é¡¾æ°æç æ以åä¹æ¯æ°æå æ°æè§æ°æ两ç¼æ³ªæºæº 顺便æåç»æå§
é¦å 建ç«ä¸ä¸ªcommand1 ç¶ååªåå¤å¶ ç³»ç»æ示说已ç»æä¸ä¸ªCOMMAND1 æ¯å¦è¦å»ºç«æ§ä»¶æ°ç»ï¼
ä½ ç¹å»æ¯ è¿æ ·éå¤9次 åå«æcaption该æ0å°9 ç¶å建ç«command2 æ¹æ³åä¸,caption为 +-*/ ç¶åæ¯ command3 captionæ¯=
ç¶åè¾å ¥ä»£ç ,é¦å å¨éç¨éçå½dim shu1,shu2
dim suanfu as string
private sub command1(index)_click
text1.text=text1.text & commmand1(index).capton
end sub
command2é è¾å ¥
shu1=text1.text
suanfu=text1.text & command(index).capiton
text1.text=""
end sub
command3éè¾å ¥
shu2=text1.text
selece case suanfu
case "+"
text1.text=shu1+shu2
case "-"
text1.text=shu1-shu2
case "*"
text1.text=shu*shu2
case "/"
if shu2=0 then
msgbox "åæ¯ä¸è½ä¸º0"
else text1.text=shu1/shu2
end if
end select
end sub
è¿æ¯æç®åç计ç®å¨ç å¦æè¿éè¦ä»ä¹åè½ æä¹å¯ä»¥åè¯ä½ ç æå¦VB3个æäº ç¥æå°æ æ以æ³æ¥ç §é¡¾æ°æç æ以åä¹æ¯æ°æå æ°æè§æ°æ两ç¼æ³ªæºæº 顺便æåç»æå§
温馨提示:答案为网友推荐,仅供参考