CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 1999
    Posts
    28

    Event tracking of controls created during run-time

    Hi all,

    I have some vb controls dynymically created during the form load, like this during the form_load:

    set objCtl = controls.Add(strCtlNameVB, strCtlNameCtl)



    In other word, I don't know the name, type of these controls when I design the form. How can I track the event for these controls, such as LostFocus? I tried to use Controls collection but no luck.

    Thanks,

    Joe
    chunjoeli@hotmail.com


  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Event tracking of controls created during run-time

    You probably need to put this in a Class module.
    There is a tutorial on
    http://www.**************/
    titled "CATCHING EVENTS OF DINAMICALY ADDED CONTROL ARRAYS" which discusses how to accomplish this but this tutorial has several flaws. It is doable however if you have enough programming experience to overcome them. (note the spelling of Dynamically in its title)

    John G

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Event tracking of controls created during run-time

    I was looking for it. I cannot test it right now, but I will do. Thanks for sharing, John.


    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Jun 1999
    Posts
    28

    Re: Event tracking of controls created during run-time

    Thanks John, that was very helpful.


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

Featured