在窗体上画一个命令按和一个文本框,并将窗体的KeyPreview属性设置为True,然后编写如下代码: Dim SaveAll As String Private Sub Form_Load() Show Text1.Text=' ' Text1.SetFocus End Sub Private Sub Command1_Click() Text1.Text = Ucase(SaveAll) End Sub Private Sub Form_KeyPress(KeyAscii As Integer) SaveAll=SaveAll+Chr(KeyAscii) End Sub 程序运行后,在键盘上输入abcdefg,单击命令按,则文本框中显示的内容为