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