473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Binding RadioButtons

Of all the VB.NET techniques I've learned so far, databinding has to be the
most complicated. I've got a problem (among others) with radio buttons. I
finally got the radion buttons to bind correctly when the form first loads,
but now changing them doesn't update the dataset properly.

I have on the form two group boxes, each with two radio buttons. The
Checked property of all four buttons are bound to Yes/No fields in an Access
database. When the form loads, the correct buttons are checked--the first
buttons in each group box. When I click the second button in one the boxes,
it becomes checked and the first one is unchecked. But then when I move the
focus, the first one
becomes checked again and the second unchecked. I've put a datagrid on the
form to see what's happening to the dataset -- when I click the second
button and move the focus, only the field for the second button in the
datagrid is updated, not the first. That is, the field for the second
button becomes checked, but the first one does not become unchecked.

If someone can make sense of what I'm saying and help me out, I'd really
appreciate it.

Nov 20 '05 #1
2 2411
Ahh, well, I think that you need to do a DataAdatpter.Update() After
changing the status of the Radio buttons. Try it and let me know if this
does the trick.

Regards - OHM
Nathan wrote:
Of all the VB.NET techniques I've learned so far, databinding has to
be the most complicated. I've got a problem (among others) with
radio buttons. I finally got the radion buttons to bind correctly
when the form first loads, but now changing them doesn't update the
dataset properly.

I have on the form two group boxes, each with two radio buttons. The
Checked property of all four buttons are bound to Yes/No fields in an
Access database. When the form loads, the correct buttons are
checked--the first buttons in each group box. When I click the second
button in one the boxes, it becomes checked and the first one is
unchecked. But then when I move the focus, the first one
becomes checked again and the second unchecked. I've put a datagrid
on the form to see what's happening to the dataset -- when I click
the second button and move the focus, only the field for the second
button in the datagrid is updated, not the first. That is, the field
for the second button becomes checked, but the first one does not
become unchecked.

If someone can make sense of what I'm saying and help me out, I'd
really appreciate it.


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #2
["Followup-To:" header set to microsoft.public.dotnet.framework.windowsforms.dat abinding.]
On 2004-01-02, Nathan <nk*********************@softhome.net> wrote:
Of all the VB.NET techniques I've learned so far, databinding has to be the
most complicated. I've got a problem (among others) with radio buttons. I
finally got the radion buttons to bind correctly when the form first loads,
but now changing them doesn't update the dataset properly.


This is pretty similar to the problem that gets mentioned a lot here
about databound combo boxes not updating when you set their index.

As a general guideline, databinding updates on UI user actions, not on
programmatic actions. If the user initiates an action on the control,
databinding will update the underlying data, but if you set the control
property in code, databinding will ignore the action (that's not 100%
true, but useful as a general rule).

When you click the second radio button, that's a UI action and the data
updates correctly. But the first radio button is set to unchecked
programmatically, and databinding ignores it. Why? I dunno, that's just
the way it is.

The workaround to this is to set the properties in your dataset
directly, either in a DataTable ColumnChanged event or in the Radio
Button click event or validate event.

Note followups changed...
--
David
dfoster at
hotpop dot com
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
1
by: Savvas | last post by:
Dear Cor Ligthert My account is not yet validated so i cannot log in to reply directly to you. An analogy of what i need is the following: Say e.g. you have a groub box "Sex" and two radio...
1
by: --=|3s|=-- | last post by:
Hi, I'm trying to create a form in VISUAL BASIC .NET wich shows values of records from a customers table. For example a form wich shows the name, surname and sex of a person. For the name &...
11
by: Rourke Eleven | last post by:
I have looked and searched. What good is the databind property on Radiobuttons? How does one go about actually using it? What is a good resource on this? I understand that I can easily get/set...
2
by: Chris Ashley | last post by:
I have a couple of RadioButtons both with the same GroupName. Is there any way I can use a RequiredFieldValidator to ensure that at least one of the RadioButtons in the group is selected? Setting...
4
by: news.microsoft.com | last post by:
Hello, I have two databound radiobuttons which have advanced databinding properties of onpropertychanged enabled so that I can raise the columnchanged event whenever the radiobuttons are...
0
by: PaulS | last post by:
Hello! I put on Form PictureBox and I set big image. Next I put many radiobuttons (80) on PictureBox, but I have problem. I want that 10 radiobuttons have own Checked, next part of 10...
4
by: PedroVision | last post by:
I have a VB 2005 form with 140 different radiobuttons... Some are "checked", some are not... I want to reset all radiobuttons to "unchecked". I've been searching and trying differnet...
8
by: =?Utf-8?B?UmljaA==?= | last post by:
If you enclose a group of radiobuttons (option buttons in MS Access) in an option group control (a frame control) in Access -- the frame control will return the index of the option button that is...
0
by: | last post by:
I am using radiobuttons in a gridview, and not a column of radiobuttons. I have one cell in each row with several radiobuttons that the user has to choose a radiobutton within each row. How can I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.