How do I apply VB code to a control array object created by code?

Discussion in 'Visual Basic ( VB )' started by Emerogork, Oct 6, 2012.

  1. Emerogork

    Emerogork New Member

    Joined:
    Jul 24, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I have a control array creating 10 radio buttons and code creating an exit button. Since the form is blank when writing code, I cannot double click on an object to create the sub routine to code it. I have the software working for a single code-created exit button and created the subroutine for that but I cannot seem to get the code to work for an array of code-created objects. I believe it is all in the Addhandler language but don't understand how to write the code. I would appreciate knowing what I maybe doing wrong. Specifically I need help on the last sub routine in my code. I tried to paste it here but it turned into a useless blob paragraph. I don't see an option to make it look civilized. I hope the attachment works. Sorry about the mess...
     

    Attached Files:

  2. emmawilson

    emmawilson New Member

    Joined:
    Mar 4, 2024
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Female
    Occupation:
    Developer
    Location:
    India
    To dynamically create event handlers for an array of radio buttons and an exit button in Visual Basic:

    • Use AddHandler to attach event handlers to each control.
    • For the radio buttons, handle the CheckedChanged event.
    • For the exit button, handle the Click event to close the form.
    • Ensure to replace the event handling code with your specific functionality.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice