vb程序设计输入一个数字1~7,分别用select语句和choose函数两种方法用英文显示对应的星期一~星期日

2025-03-22 11:36:43
推荐回答(1个)
回答1:

dim i as integer
private sub command1_click() 'select case 方法
text1.text =int(val(text1.text))
if text1.text >0 and text1.text <8 then
i = text1.text
select case i

case 1

debug.print "Monday"

case 2

debug.print "Tuseday"
……

end select

end if
end sub
private sub command2_click() 'choose方法
text1.text =int(val(text1.text))
if text1.text >0 and text1.text <8 then
i = text1.text
debug.print choose(i,"Monday","Tuseday",……,"Sunday")

end if
end sub