mardi 19 mai 2020

Dynamically displaying a checkbox in C++ windows Forms

I would like to display a checkbox dynamically on clicking a button in C++ windows Forms. How could I achieve that. I wrote the following code in a button click event.

System::Windows::Forms::CheckBox^  checkBox9;
checkBox9 = (gcnew System::Windows::Forms::CheckBox());
checkBox9->AutoSize = true;
checkBox9->Location = System::Drawing::Point(43, 38);
checkBox9->Name = L"checkBox9";
checkBox9->Size = System::Drawing::Size(98, 21);
checkBox9->TabIndex = 1;
checkBox9->Text = L"checkBox9";
checkBox9->UseVisualStyleBackColor = true;
checkBox9->CheckedChanged += gcnew System::EventHandler(this, &MyForm::checkBox9_CheckedChanged);

But this does not work. I am unable to display the check box on clicking the button. Please support.




Aucun commentaire:

Enregistrer un commentaire