473,732 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2425
Ahh, well, I think that you need to do a DataAdatpter.Up date() 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}BTInte rnet{dot}com
Nov 20 '05 #2
["Followup-To:" header set to microsoft.publi c.dotnet.framew ork.windowsform s.databinding.]
On 2004-01-02, Nathan <nk************ *********@softh ome.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
programmaticall y, 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
2628
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
1943
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 buttons "Male" and "Female". When you recall the form to edit the information of the person to change from male to female :) what is the binding i have to make. From
1
1610
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 & surname i create a textbox. then I select the correct table in the databinding propertie of the name and surname textbox. but for showing the correct sex of a person, i would like to use a radiobuttons. So i create 2 radiobuttons on my form (rbMale &...
11
4660
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 the information I need programmatically, but what about the databind property I just don't understand it's value.
2
15086
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 ControlToValidate to the GroupName doesn't seem to work, and obviously setting it to the ID of one of the individual RadioButtons won't work.. any ideas? Thanks in advance, Chris
4
2106
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 changed. In the columnchanged event I am simply accepting changes into the dataset. There is no dataadapter because it is a standalone dataset. When one radiobutton is already checked (as opposed to neither) and I select
0
1425
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 radiobuttons have own Checked, etc. I tried add GroupBox on PictureBox, next add RadioButtons. But there is problem that I can't set visible only RadioButtons on image (GroupBox must be hidden). I tried option: "Send to Back" but it hide also
4
1705
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 things...there must be a way to access radiobuttons by their "names"... Typical names used include... RadioButton011
8
44035
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 checked. In VB.Net if I enclose a group of radiobuttons in a groupbox control - I get the single checked radiobutton behavior, but the groupbox does not seem to return the index of the checked radiobutton. Is there a way to get the groupbox...
0
1047
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 capture which radiobutton in which row the user has clicked. Even with AutoPostback=true, the gridview's rowcommand doesn't fire. The rowcreated event does, but I can't tell which row I'm on. Thanks for your help.
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.