输入到记事本,保存为Form1.frm即可 每行代码均写了注释,应该知道意思了 VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 3840 ClientLeft = 60 ClientTop = 450 ClientWidth = 5625 LinkTopic = "Form1" ScaleHeight = 3840 ScaleWidth = 5625 StartUpPosition = 3 '窗口缺省 Begin VB.TextBox Text1 Height = 495 Left = 720 TabIndex = 0 Top = 840 Width = 3975 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Text1_KeyPress(KeyAscii As Integer) Static sum% '定义一个静态变量sum用作计数器 If KeyAscii = 13 Then '如果键入了一个回车则算一次输入(其他的可以自己改) sum = sum + 1 '计数器加1 KeyAscii = 0 '忽略回车符的输入 If sum = 3 Then MsgBox "输入三次了!": Text1.Enabled = False '当输入次数达到3次是提示,并屏蔽Text1 End If End Sub