How to access properties on dynamically created radio button

  • Thread starter Thread starter Steve Clark
  • Start date Start date
S

Steve Clark

Hope someone can provide some help here. In an application we are
developing with VB.NET, we generate several radio buttons on the main form
dynamically. We want to programatically mark a specific radio button as
"checked" or "unchecked". The buttons reside on a panel, and accessing them
via frmMain.pnlButtons.Control.Item(X).... does not give us access to the
"Checked" property. Seems like we ought to be able to do this...any
suggestions?

Thanks.

Steve
 
* "Steve Clark said:
Hope someone can provide some help here. In an application we are
developing with VB.NET, we generate several radio buttons on the main form
dynamically. We want to programatically mark a specific radio button as
"checked" or "unchecked". The buttons reside on a panel, and accessing them
via frmMain.pnlButtons.Control.Item(X).... does not give us access to the
"Checked" property. Seems like we ought to be able to do this...any
suggestions?

\\\
DirectCast(frmMain.pnlButtons.Controls(X), CheckBox).Checked = True
///
 
Hi Steve,

It depends how you create them, if it is not using an array it should be as
simple as

\\\
me.myradiobutton.checked = true
///
Cor
 
* "Steve Clark said:
\\\
DirectCast(frmMain.pnlButtons.Controls(X), CheckBox).Checked = True
///

Are you sure of that, does a cast of a CheckBox also fit for a RadioButton?

:-)) (I know it: typos)

(Hi steve if you read it and you are able to access them using that X,
change CheckBox for RadioButton)

Cor
 
Herfried K. Wagner said:
\\\
DirectCast(frmMain.pnlButtons.Controls(X), CheckBox).Checked = True
///

Thanks, Herfried. That works great...just what I was looking for. Don't
really understand why we need to do that, but I can live with it. Thanks
again. :-)
 
Back
Top