Results 1 to 3 of 3

Thread: How to access the event in simplest way

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    How to access the event in simplest way

    Normally, if I want to make my textbox or combobox change the backcolor when the user gotfocus on the controls i will using the code like this.

    VB Code:
    1. Private Sub Text1_GotFocus()
    2.  
    3.    Text1.BackColor = vbYellow
    4. End  Sub
    5.  
    6. Private Sub Text1_LostFocus()
    7.  
    8.    Text1.BackColor = vbWhite
    9. End Sub

    But I need to create the code for every control

    Got any method allowed me to do only one time for every control ?

    Thanks
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: How to access the event in simplest way

    Every control? Or every Textbox? If its every textbox.. then just use a control array (search the forums for that).

    If its for every control.. then you'll have to subclass the form and change the backcolor of the control through APIs (because theres no way to do something like, wParam.BackColor..).

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: How to access the event in simplest way

    Yes, The only way is array ..
    I had changed it ...
    Thanks sir..
    I'm Not similar to APIs ...
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

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