See Also Example
Applies To
Text box.
Description
Specifies whether selected text appears highlighted when a control loses the focus. Read-only at run time.
Usage
[form.]textbox.HideSelection
Setting
The HideSelection property settings are:
Setting Description
True (Default) Selected text does not appear selected when the control loses the focus.
False Selected text appears selected when the control loses the focus.
Remarks
You can use this property to indicate which text is selected while another form or a dialog box has the focusfor example, in a spell-checking routine.
Data Type
Integer (Boolean)
Programmer's Guide:
Chapter 3, "Creating and Using Controls"
HideSelection Property Example
The example lets you select text in each form and change the focus between forms by clicking the title bar. In one form, the selection will remain visible even when the form is not active. To try the example, create two forms and draw a text box on each. Set the MultiLine property to True for both text boxes, and set the HideSelection property to False for one of the text boxes. Paste the code into the Declarations section of both form modules and press F5.
Sub Form_Load ()
Open "constant.txt" For Input As 1 ' Load file into text box.
Text1.Text = Input$(LOF(1), 1)
Close 1
Form2.Visible = True ' Load Form2, if not already loaded.
' Position forms side by side.
Form1.Move 0, 1050, Screen.Width / 2, Screen.Height
Form2.Move Screen.Width / 2, 1050, Screen.Width / 2, Screen.Height
' Enlarge text box to fill form.
Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub