Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with option group values

Status
Not open for further replies.

Paco75

Programmer
Oct 11, 2001
239
US
Hi,

I have a option group object with 3 radio buttons inside. Now i want to add 2 more options but i want them to be first and second... when i add them they automatically got 4 and 5 as values. Even if i move them in first place, change tab order.

here is what i got :

Option4 Option5 Option1 Option2 Option3

if i do thisform.OptionGroup.value = 1 it is always "Option1" but i want it to be "Option4" (one of the two newly added)

thanks
 
Option4 Option5 Option1 Option2 Option3

That is to be expected.

When you first created and added the OptionGroup it had only 3 choice options (1 thru 3)
Now you have added 2 more which are sequentially identified as 4 & 5.

This designation remains no matter where they physically appear on the Form.

You can change the name property of the individual choice option objects to something more meaningful and then the 4,5,1,2,3 will no longer be a problem.

Or you can Delete the original OptionGroup object and then add a new one with 5 elements.

Good Luck,
JRB-Bldr
 
Paco,

The names of the option buttons ("Option1", etc) have got nothing to do with the value of the option group as a whole. Those values will be 1, 2, etc, and will reflect the order in which you added the option buttons.

If you really can't live with that, I suggest you start again. Create a new option group, with all five buttons at the outset. Copy and paste the code from the old one to the new one, then throw away the old one.

This will save you time in the long run.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top