Ask a Question

How to access UserForm radio button Caption

SOLVED
RobertDAltman
Occasional Contributor

How to access UserForm radio button Caption

I have a UserForm that I display from JavaScript

 

var userForm = UserForms.StartupForm;
var formResult = userForm.ShowModal();

The UserForm contains a RadioGroup with several radio buttons on it.  How do I fetch the Caption property of the selected radio button?

2 REPLIES 2
YuriPeshekhonov
SmartBear Alumni (Retired)

Hi,

 

The "ItemIndex"property returns the selected item index:

 

var index = UserForms.UserForm1.cxRadioGroup1.ItemIndex

Regards,
Yuriy Peshekhonov
Customer Care Engineer
RobertDAltman
Occasional Contributor

Many thanks to Evgeny in tech support for this solution:

 

// In this example, a form named MyForm contains a radio button group
// named radioGroup.

// Display a modal form var frm = UserForms.MyForm; var modalResult = frm.ShowModal(); // Get the selected radio button var idx = frm.radioGroup.ItemIndex; var rb = frm.radioGroup.ChildControl(idx); // Access properties on the radio button control var selectedCaption = rb.Caption;

Note that code completion doesn't display any properties or methods for the radio button object.

cancel
Showing results for 
Search instead for 
Did you mean: