打印本文 打印本文  关闭窗口 关闭窗口  
自动选择Text的内容
作者:佚名  文章来源:不详  点击数  更新时间:2008/4/18 14:51:11  文章录入:杜斌  责任编辑:杜斌

在使用 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

打印本文 打印本文  关闭窗口 关闭窗口