Results 1 to 2 of 2

Thread: [2005] How to set an common property for all the text boxes in the form

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,158

    [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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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:
    1. 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width