+ Reply to Thread
Results 1 to 4 of 4

Dynamic Controls with event handlers

  1. #1
    Registered User
    Join Date
    02-14-2010
    Location
    Scotland
    MS-Off Ver
    MS Office 2013
    Posts
    35

    Dynamic Controls with event handlers

    Hi All,

    I have been looking at a way to add event handlers to control items I have dynamically created at run time. The userform I have created acts like a wizard for the end user and allows them to streamline their process by having pre-defined information stored within a sheet that will pull though when certain information has been selected. The number of required control items is unknown so this would be the preferred option for me. Again, any help on where I may have gone wrong (Code below) would be much appriciated.

    The focus area on which I appear to be having the issue is within the "Addline" procedure (Paticularly the lines :Dim LR As New LineRemover, Set LR.Control = Cheb(iCount)).

    The Cheb(iCount) control value passes a "False" value and does not update the useform when I select the paticular item.

    Apologies if my code is a bit messy!

    My Userform Code
    Please Login or Register  to view this content.
    My Class Module Code Titled "LineRemover"
    Please Login or Register  to view this content.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Dynamic Controls with event handlers

    you might wanna post a workbook.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Dynamic Controls with event handlers

    Hello stuart010,

    After looking over your code, you don't instantiate the new class and assign the new objects to existing ones on the UserForm. The attached workbook is a example of how to properly use the WithEvents in a Class module and assign the new class objects to existing ones. The code below is already added to the attached workbook.

    Class Module - chkboxClass
    Please Login or Register  to view this content.
    UserForm1 Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    02-14-2010
    Location
    Scotland
    MS-Off Ver
    MS Office 2013
    Posts
    35

    Re: Dynamic Controls with event handlers

    Hi Leith,

    Thanks for the reply, your code was enough to help me understand what I needed to do to acheive the result.

    Regards

    Stuart

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1