469,950 Members | 1,598 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Option Buttons in VB.NET

PM
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
Aug 24 '05 #1
2 2059
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" <PM@discussions.microsoft.com> wrote in message
news:2E**********************************@microsof t.com...
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

Aug 24 '05 #2
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
Aug 24 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Georges Heinesch | last post: by
1 post views Thread by Stephen D Cook | last post: by
1 post views Thread by Stephen D Cook | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.