Option Buttons in VB.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a question about option buttons and their values.

I have many option buttons on my forms, each set contained in their own
group boxes.

I simply want to be able to give them a value, which can be returned to a
single field in my database.

For example, if I have a group box with 5 option buttons, I want each to
have a value. (0, 1, 2, 3, 4). The first one would send a value of '0' to
the appropriate field in the database, the second one would send a 1 instead,
and so on.

Does anyone know how to do this, and send it back to the database? I'm
really stuck.

Thanks
PM
 
If you are using the desinger and a typed dataset, you can just specify the
datasource in the DataBindings property of the properties window. Set the
dataset, datatable and field value. However this won't do exactly what you
want, it will simply bind it to a field. If you want to send back different
values to the same field, trap the checkChanged event and then set the
field's value from there depending on which radiobutton was chekced.
 
PM,

For this is the tag from every control very useful.
Simply fill in that the value.
As string it is than
button1.tag.toString
As integer
Cint(button1.tag)

I hope this helps,

Cor
 
Back
Top