[2005] How to set an common property for all the text boxes in the form
when ever an textbox is focused i want its complete text to be selected and its back color to be changed. I dont wana write code for each text box, how can i set these property for all text boxes
note: The Text boxes are not in an array
Re: [2005] How to set an common property for all the text boxes in the form
In the designer select all the TextBoxes. Open the Properties window and click the Events button. Double-click the Enter event. That will create a common event handler for all the controls. Add this code to the event handler:
vb Code:
DirectCast(sender, TextBox).SelectAll()
If you ever add any more TextBoxes you would select the existing event handler from the drop-down list rather than double-clicking the event.