根据用户要求,我需要在 VB 6.0 用户输入表单中将 Enter 键用作 Tab 键。
对于特定控件,我可以使用 SendKeys“{TAB}”,但是有什么方法可以让表单上的所有控件都将输入键作为制表键。
问候。
拉扎
根据用户要求,我需要在 VB 6.0 用户输入表单中将 Enter 键用作 Tab 键。
对于特定控件,我可以使用 SendKeys“{TAB}”,但是有什么方法可以让表单上的所有控件都将输入键作为制表键。
问候。
拉扎
您可以创建一个控件数组并尝试以下示例:
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
'If I press Enter key...
If KeyAscii = 13 Then
With Text1(Index)
'I add a tab.
.Text = .Text & vbTab
'I placed in the end of the text.
.SelStart = Len(.Text)
End With
'And finally I omit the enter key pressed.
KeyAscii = 0
End If
End Sub
我创建了一个名为 Text1 的文本框数组。我希望它有所帮助。