VB编程求救,急!!!

来源:百度知道 编辑:UC知道 时间:2024/06/12 00:08:15
1.编写一个倒计时程序,实时显示倒计时时间,当时间为零时,弹出一个消息框。要求使用timer控件。
2.计算输入的两个日期相差多少天?
3.输入一个字符串,统计a ,b,c出现的次数。
3.要用数组作统计

1:
private sub timer1_timer()
label1.caption=val(label1.caption)-1
if label1.caption=0 then
msgbox "倒计时结束"
end sub
private sub form_load()
timer1.enabled=false
timer1.inteval=1000
command1.caption="开始计时"
end sub
private sub command1_click()
if command1.caption="开始计时" then
timer1.enabled=ture
command1.caption="停止计时"
timer1.enabled=false
command1.caption="开始计时"
end if
end sub
2:
private sub command1_click()
text3=datadiff("d",cdata(text1),cdata(text2))
end sub
3:
private sub command1_click()
static a,b,c as integer
a=0:b=0:c=0
for i=1 to len(text1)
select case mid(text1,i,1)
case "a"
a=a+1
case "b"
b=b+1
case "c"
c=c+1
end select

print "a共出现" & str(a) & "次"
print "b共出现" & str(