getting handles from radio buttons

G

Guest

I've got a Windows Forms Application project where I'm using 2 radial buttons.
I want to poll whether the radial button has been pressed or not. Here's one
way I think it could work, using the Checked property :

bool r1=System::Windows::Forms::RadioButton::get_Checked;

but how do I specify that I'm looking for the Checked property of
radiobutton1 ??
I intend to use r1 as a variable defined in the function created by the
click event handler of radial buttons 1 & 2. Can I define r1 outside this
function ?

Thanks for the help,
AK
 
T

Tim Robinson

AK said:
bool r1=System::Windows::Forms::RadioButton::get_Checked;

but how do I specify that I'm looking for the Checked property of
radiobutton1 ??

You use:
bool r1 = radiobutton1->Checked;

Can I assume that radiobutton1 is a class member variable? Was it defined by
the form designer?
I intend to use r1 as a variable defined in the function created by
the
click event handler of radial buttons 1 & 2. Can I define r1 outside
this function ?

Sure, make it a class member variable. But then again, radiobutton1->Checked
is accessible anywhere within the class, so why bother?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top