English 中文(简体)
Access 2007中的OnKeyUp事件
原标题:
  • 时间:2009-04-09 02:08:34
  •  标签:

我在Access表单中有一个文本框和一个标签。无论在文本框中键入什么,都需要在标签中反映/镜像,我必须对文本框使用OnKeyUp事件。我该怎么做?这是一项家庭作业。我没有编程经验,这是我第一次上编程课。到目前为止,我有这个:

Private Sub Text0_KeyUp(keycode As Integer, Shift As Integer)
    Label2 = Text0.Text.KeyUp
End Sub
问题回答

Use the change event of the textbox & set Label2.Caption = Text0.Text in that event.
The change event occurs when the contents of the textbox changes.

与KeyUp函数内联。

Private Sub tbTextBox(KeyCode As Integer, Shift As Integer)
   Dim textBoxtext As String 

   textBoxtext = Me.tbTextBox.text  put the textbox text in the string
   lbLabel = textBoxText  put the text in the string to the label
End Sub

试试这个,我在Microsoft Access 2007上为您测试过:

Private Sub Text0_KeyUp(keycode As Integer, Shift As Integer)
  Me.Label2.Caption = Me.Text0.Text
End Sub

其中Me表示当前Form对象。





相关问题
热门标签