T
teddysnips
Back in the dim mists of antiquity I used to program in VBA for
Microsoft Access (hey, don't knock it - very useful tool for the right
application).
This had a really handy control in the toolbox called an Option
Group. It could contain any number of radio buttons (which Access
called Option Buttons), each of which had a "value" property. The
Option Group as a whole had a property equal to the value of the
selected radio button. Thus you could bind the group to a single
datum.
Example. Let's say a "Person" record contains a column called
"PreferredTransport" (type = integer). This can take any of three
values:
0 = Car
1 = Train
2 = Bus
How simple, therefore, to create an OptionGroup called "Transport",
with three radio buttons as above and set it according to the value of
the "PreferredTransport" column.
Why isn't this available out of the box in C# for Windows Forms? Does
anyone know of a site where I could get an example of a workaround? I
know I can do it the hard way - either binding each radio button on my
form to a separate datum, or having unbound radio buttons and
explicitly setting and getting the values, but it's all a bit
laborious.
Many thanks
Edward
Microsoft Access (hey, don't knock it - very useful tool for the right
application).
This had a really handy control in the toolbox called an Option
Group. It could contain any number of radio buttons (which Access
called Option Buttons), each of which had a "value" property. The
Option Group as a whole had a property equal to the value of the
selected radio button. Thus you could bind the group to a single
datum.
Example. Let's say a "Person" record contains a column called
"PreferredTransport" (type = integer). This can take any of three
values:
0 = Car
1 = Train
2 = Bus
How simple, therefore, to create an OptionGroup called "Transport",
with three radio buttons as above and set it according to the value of
the "PreferredTransport" column.
Why isn't this available out of the box in C# for Windows Forms? Does
anyone know of a site where I could get an example of a workaround? I
know I can do it the hard way - either binding each radio button on my
form to a separate datum, or having unbound radio buttons and
explicitly setting and getting the values, but it's all a bit
laborious.
Many thanks
Edward