Need a suggestion on how to make a button do something. - 03-15-2010 , 09:21 PM
I have invested years and years into Visual Basic in Visual Studio and the
MS Office products. Now, I’m taking a look at Visual c++ looking at it with
Visual c++ Express 2008. It looks really promising. And there are some
significant improvements since my old copy of Visual Studio was purhased. I
have written many plain old c functions in the vc++ environment, and today
moved to a new step.
I created a project with a form, (same as I did in VB) and added a button
“button1” then I looked at the code that shows properties for button1 and
that is shown below…
this->button1 = (gcnew System::Windows::Forms::Button());
this->button1->Location = System:rawing::Point(136, 23);
this->button1->Name = L"button1";
this->button1->Size = System:rawing::Size(89, 42);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
So it looks like I can make button1 call a function or do something by using
OnClick, but it would be helpful to see some code that does something when
OnClick happens. Does the code build on the followng?
this->button1->OnClick ... ??? how do I do something here, ie call a function
or is there some other way…
Thank you for giving me a lead on where this might go next.
Re: Need a suggestion on how to make a button do something. - 03-31-2010 , 10:13 AM
"Keith" <Keith (AT) discussions (DOT) microsoft.com> wrote
procedures for the button and place any code you want to execute in the body
of the desired event procedure, just as you would in VB.
As the Click event is the default for a button, you can double-click on the
button in design view to create the event procedure shell.
|Thread Tools||Search this Thread|