2. Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Command1_Click() Dim r As Integer r = CInt(InputBox("please enter an integer", "info", 50)) Do While r >= 0 Command1.Caption = r r = r - 1 Sleep 200 DoEvents Loop End Sub
1、 先添加commondialog控件 private sub command1_click() commondialog1.showfont end sub 2、 Dim r Dim s Private Sub Command1_Click() r = InputBox("请输入一个整数") s = Val(r) Timer1.Interval = 1000 End SubPrivate Sub Timer1_Timer() s = s - 1 Text1.Text = s End Sub 3、Private Sub Command1_Click(Index As Integer) dim a dim b dim s a=val(text1.text) b=val(text2.text) select case index case 0 s=a+b case 1 s=a-b case 2 s=a*b case 3 s=a/b end selectEnd Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Command1_Click() Dim r As Integer r = CInt(Text1.Text) Do While r >= 0 Text1.Text = r r = r - 1 Sleep 200 DoEvents Loop End SubPrivate Sub Form_Load() Text1.Text = 50 Text1.TabIndex = 0 SendKeys "+{end}" End Sub
太简单了,我也来抢分 1,显示字体使用CommonDialog控件(右击左边的控件,选择部件,添加:microsoft common dialog control 6.0),要有安装字体CommonDialog1.ShowFont 2. Private Sub Command1_Click() On Error GoTo 999 Dim int1 As Integer If Len(Text1.Text) = 0 Then Exit Sub '没有输入何数字 int1 = CInt(Text1.Text) text2.text=text1.text timer1.Interval =1000 '每秒倒数一次 timer1.Enabled =True Exit Sub 999 Select Case Err.Number Case 6 MsgBox "您输入的数太大,请输入一个0~38768之间的数", vbOKOnly + vbExclamation, "输入有误" text1.text="" text1.SetFocus Case 13 MsgBox "请输入纯数字!", vbOKOnly + vbExclamation, "输入有误" text1.text="" text1.SetFocus end Select end sub Private Sub Timer1_Timer() text2.text=cint(text2.text)-1 End Sub 3使用各种方法得到数A,数B 相乘 a*b 相除 a/b 相加 a+b 相减 a-b
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim r As Integer
r = CInt(InputBox("please enter an integer", "info", 50))
Do While r >= 0
Command1.Caption = r
r = r - 1
Sleep 200
DoEvents
Loop
End Sub
先添加commondialog控件
private sub command1_click()
commondialog1.showfont
end sub
2、
Dim r
Dim s
Private Sub Command1_Click()
r = InputBox("请输入一个整数")
s = Val(r)
Timer1.Interval = 1000
End SubPrivate Sub Timer1_Timer()
s = s - 1
Text1.Text = s
End Sub
3、Private Sub Command1_Click(Index As Integer)
dim a
dim b
dim s
a=val(text1.text)
b=val(text2.text)
select case index
case 0
s=a+b
case 1
s=a-b
case 2
s=a*b
case 3
s=a/b
end selectEnd Sub
后面的text1.text换成label1.caption
这样就可以了
Private Sub Command1_Click()
Dim r As Integer
r = CInt(Text1.Text)
Do While r >= 0
Text1.Text = r
r = r - 1
Sleep 200
DoEvents
Loop
End SubPrivate Sub Form_Load()
Text1.Text = 50
Text1.TabIndex = 0
SendKeys "+{end}"
End Sub
你也太狠了吧
动不动就用api
你是老大啊
我们怎么办
看不懂啊
郁闷
不知道lz能不能看懂哦
我都写那么清楚了还不明白?
就是你要先添加那个commondialog
在你画控件的哪个地方击右键再选部件
再找到microsoft commondialog
我可不在乎我的分啊
写代码的人
多写一点也好
熟悉了自己的手
而且
对新人要态度好点嘛
我也刚学不久
看到我班上的人和lz差不多这样的
哎
1,显示字体使用CommonDialog控件(右击左边的控件,选择部件,添加:microsoft common dialog control 6.0),要有安装字体CommonDialog1.ShowFont
2.
Private Sub Command1_Click()
On Error GoTo 999
Dim int1 As Integer
If Len(Text1.Text) = 0 Then Exit Sub '没有输入何数字
int1 = CInt(Text1.Text)
text2.text=text1.text
timer1.Interval =1000 '每秒倒数一次
timer1.Enabled =True Exit Sub
999
Select Case Err.Number
Case 6
MsgBox "您输入的数太大,请输入一个0~38768之间的数", vbOKOnly + vbExclamation, "输入有误"
text1.text=""
text1.SetFocus
Case 13
MsgBox "请输入纯数字!", vbOKOnly + vbExclamation, "输入有误"
text1.text=""
text1.SetFocus
end Select
end sub
Private Sub Timer1_Timer()
text2.text=cint(text2.text)-1
End Sub
3使用各种方法得到数A,数B
相乘
a*b
相除
a/b
相加
a+b
相减
a-b