用VB语言设计程序

用VB语言设计程序,第1张

建立三个command1至3

Option Explicit

Private Sub Command1_Click()

Cls

Dim I As Byte, J As Byte

Dim Letter(1 To 10) As String

Randomize

For I = 1 To 10

Letter(I) = Chr(Int(Rnd 26) + 65)

'Print I; Letter(I);

For J = 1 To I - 1

If Letter(I) = Letter(J) Then

I = I - 1

Exit For

End If

Next

Next

For I = 1 To 10

Print I; Letter(I)

Next

End Sub

Private Sub Command2_Click()

Cls

Dim I As Integer, J As Integer

For I = 1 To 999

If Left(Trim(Str(I)), 1) = Right(Trim(Str(I)), 1) Then

J = J + 1

Print J; I,

If J Mod 5 = 0 Then Print

End If

Next

Print "共有" & J & "个回文数"

End Sub

Private Sub Command3_Click()

End

End Sub

Private Sub Form_Load()

Form1AutoRedraw = True

Command1Caption = "大写字母"

Command2Caption = "回文数"

Command3Caption = "退出"

End Sub

已经运行过。不知道是不是你想要的。

'新建一个窗体,上面插入label标签,并插入两个check复选框

Private Sub Check1_Click()

If Check1Value = 1 Then Label1FontBold = True Else Label1FontBold = False

End Sub

Private Sub Check2_Click()

If Check2Value = 1 Then Label1FontItalic = True Else Label1FontItalic = False

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = &H75 And Shift = 5 Then

Print "再见"

End

End If

End Sub

运行过程很快,你有可能看不到窗体上的“再见”

你可以把其中的end 去掉看看

欢迎分享,转载请注明来源:表白网

原文地址:https://h5.hunlipic.com/biaobai/3367912.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2024-02-24
下一篇2024-02-24

发表评论

登录后才能评论

评论列表(0条)

    保存