Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7818095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:27:41+00:00 2026-06-02T06:27:41+00:00

I create a user control group sub-class. There are two radiobuttons. I need to

  • 0

I create a user control group sub-class. There are two radiobuttons. I need to create event handlers for them. I have two directions to go. One is to create event handlers in the sub class and let the event handler to change a constant in the subclass. I will use a function to check the sub class constant in the upper class. The other one is to create event handlers in the upper class for the sub-class radio buttons. The following is my code for method 1.Note I have commented out two lines (they are the event handler creation) because they are wrong because they create errors please help

    using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::Collections::Generic;

#include <stdio.h>
#include <stdlib.h>
#using <mscorlib.dll>

            public ref class temp_groupbox: public GroupBox
            {
            public: temp_groupbox(int a, int b, String ^groupboxname){

                          // Create and initialize a GroupBox and two RadioButton controls.
                            //GroupBox^ groupBox1 = gcnew GroupBox;
                            RadioButton^ radioButton1 = gcnew RadioButton;
                            RadioButton^ radioButton2 = gcnew RadioButton;

                          // Add the RadioButtons to the GroupBox.
                            this->Controls->Add( radioButton1 );
                            this->Controls->Add( radioButton2 );

                            this->Location = System::Drawing::Point(a, b);
                            this->Size = System::Drawing::Size(500, 100);
                            this->TabIndex = 0;
                            this->TabStop = false;

                            radioButton1->Name = L"radioButton1";
                            radioButton2->Name = L"radioButton2";


                            radioButton1->Size = System::Drawing::Size(85, 17);
                            radioButton2->Size = System::Drawing::Size(85, 17);

                            radioButton1->Location = System::Drawing::Point(30, 40);
                            radioButton2->Location = System::Drawing::Point(30, 90);

                            radioButton1->TabIndex = 0;
                            radioButton1->TabStop = true;

                            radioButton2->TabIndex = 1;
                            radioButton2->TabStop = true;

                            radioButton1->UseVisualStyleBackColor = true;
                            radioButton1->CheckedChanged += gcnew System::EventHandler(this, radioButton1_CheckedChanged);
                            radioButton2->UseVisualStyleBackColor = true;
                            radioButton2->CheckedChanged += gcnew System::EventHandler(this, radioButton2_CheckedChanged);

                            this->SuspendLayout();
                            this->ResumeLayout(false);
                            this->PerformLayout();
                }


            public: RadioButton^ radioButton1;
            public: RadioButton^ radioButton2;
            public: int anss;

            void radioButton1_CheckedChanged(Object^ sender, EventArgs^ e)
            {
                anss = 1;
            }

            void radioButton2_CheckedChanged(Object^ sender, EventArgs^ e)
            {
                anss = 2;
            }

            };// end ref class

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:27:43+00:00Added an answer on June 2, 2026 at 6:27 am

    Do you have methods radioButton1_CheckedChanged and radioButton2_CheckedChanged defined?

    void radioButton1_CheckedChanged(Object^ sender, EventArgs^ e)
    {
    }
    
    void radioButton2_CheckedChanged(Object^ sender, EventArgs^ e)
    {
    }
    

    If these methods already exist, please list the error message you’re getting. It’s hard to figure out how to fix something if we don’t know what’s wrong.


    You need to specify the full class name of the method you’re creating a delegate for, and use the & to take the address of it.

    gcnew System::EventHandler(this, &temp_groupbox::radioButton1_CheckedChanged)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a user control, that will be used in an application
i have a login control and a create user control i my web page...i
I'm trying to create User Control which will work like a rich button. It's
Im trying to create a user control menu where links to a page's usercontrols
How can I create a user control like the Textbox? For example when I
I'm trying to create a user control that allows users to make something like
I'm trying to create a user control in WPF to represent a Go board
ASP.Net 3.5 I want to create a user control that contains the ListView and
I know how to create a custom user control in WPF but how can
I am trying to create a winForms user control. But I want would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.