Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid subscript reference (Error 31)
Message
From
17/06/1998 16:19:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
16/06/1998 12:39:00
Tan Gay Cheong
Cybercomp Computer Services
Singapore, Singapore
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00108172
Message ID:
00109262
Views:
59
>I think I have find the answer, I try to take out the customer.choice from the optiongroup1's controlsource property, and the problem solve.
>
>I don't know why we should leave the controlsource's property empty. But it works. Can explain why?

It should contain an integer, and your controlsource was character. The .value of an optiongroup is always an integer, which denotes the position of the button clicked, i.e. if you click optiongroup1.commandbutton2, then optiongroup1.value=2, for the second button.
All in all, I think you should have used a listbox or combo instead.

>I have replace the following codes in the click event.
>replace customer.choice with this.buttons(this.value).caption
>
>No more problems now.

Of course, but it won't work the other way 'round - when you display a record with some value, the corresponding button won't select automatically. You'd have to code around it in the optiongroup's refresh method, like this:

for i=1 to this.buttoncount
if customer.choice=this.buttons[i].caption
this.value=i
exit
endif
endfor

This is the reverse of what you do when you click on an individual button; when you click, you picked an integer (1,2,3... the ordinal number of the button), and assigned the customer.choice the caption of the button. This time we scan through the captions to find the one, and then pick its number.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform