用vb编写一个小程序程序

用vb编写一个小程序程序,第1张

新建一个文本框Text1,Text属性为空,MultiLine属性为True,ScrollBars属性为2。

新建一个命令按钮Command1,添加以下代码:

Private

Sub

Command1_Click()

Dim

i

As

Integer

For

i

=

1

To

100

If

(i

Mod

5

=

0)

And

(i

Mod

3

<>

0)

Then

Text1Text

=

Text1Text

&

vbCrLf

&

i

Next

End

Sub

Private Sub Command1_Click()

Dim i As Integer

For i = 0 To 10

Presskey i

Next

End Sub

Private Sub Presskey(Index As Integer)

Dim t As Single

t = Timer

Do Until Timer - t - 05 > 0

DoEvents

Loop

Select Case Index

Case 0

SendKeys " " '空格键

Case 1

SendKeys "{DOWN}" '方向键下

Case 2

SendKeys "{ENTER}" '回车键

Case 3

SendKeys "{LEFT}" '方向左

Case 4

SendKeys "{LEFT}" '方向左

Case 5

SendKeys "{ENTER}" '回车键

Case 6

SendKeys "{ENTER}" '回车键

Case 7

SendKeys " " '空格键

Case 8

SendKeys " " '空格键

Case 9

SendKeys " " '空格键

Case 10

SendKeys "{ESC}" 'ESC

End Select

End Sub

欢迎分享,转载请注明来源:浪漫分享网

原文地址:https://hunlipic.com/langman/443300.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-06-29
下一篇2023-06-29

发表评论

登录后才能评论

评论列表(0条)

    保存