发表评论(0)作者:, 平台:, 阅读:10317, 日期:2000-03-12
自动选择 Text 的内容
在使用 VFP 的应用进行录入时,每进入一个录入框,就自动选择该框中的所有
内容。利用以下的代码,也可实现类似的功能。
Private Sub MyTextBox_GotFocus()
AutoSelect MyTextBox
End Sub
Sub AutoSelect(SelObject As Control)
SelObject.SelStart = 0
If TypeOf SelObject Is MaskEdBox Then
SelObject.SelLength = Len(SelObject.FormattedText)
Else
If TypeOf SelObject Is TextBox Then
SelObject.SelLength = Len(SelObject.Text)
End If
End If
End Sub
在使用 VFP 的应用进行录入时,每进入一个录入框,就自动选择该框中的所有
内容。利用以下的代码,也可实现类似的功能。
Private Sub MyTextBox_GotFocus()
AutoSelect MyTextBox
End Sub
Sub AutoSelect(SelObject As Control)
SelObject.SelStart = 0
If TypeOf SelObject Is MaskEdBox Then
SelObject.SelLength = Len(SelObject.FormattedText)
Else
If TypeOf SelObject Is TextBox Then
SelObject.SelLength = Len(SelObject.Text)
End If
End If
End Sub