473,513 Members | 8,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Group of radio buttons

Hi,
I am failry new to this game and could use some help. Is there an easier
way..?

I get an integer fields from the database indiacting the access rights of a
user and I wish to display that on a Windows Form as a group of radio
buttons. Any cnages made to this group should filert back to the database.

I am using Dataset (using stored procedure) to retrieve the data and
objCmd.ExecuteNonQuery to save it back to DB.

Code Snipets to check radio button and the get selected button back:
' Now load radio button

If _UserRole.Rows(0).Item("AccessRights") = 0 Then

RadioBtnAllAccess.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 1 Then

RadioBtnForecastAndReports.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 2 Then

RadioBtnReportsOnly.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 9 Then

RadioBtnNoAccess.Checked = True

End If

-----------------------------------------

' Now get the selected radio button

If RadioBtnAllAccess.Checked Then

Label1.Text = "You selected " & RadioBtnAllAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 0

ElseIf RadioBtnForecastAndReports.Checked Then

Label1.Text = "You selected " & RadioBtnForecastAndReports.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 1

ElseIf RadioBtnReportsOnly.Checked Then

Label1.Text = "You selected " & RadioBtnReportsOnly.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 2

Else

Label1.Text = "You selected " & RadioBtnNoAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 9

End If

Many thanks ,
Thomas
Nov 20 '05 #1
2 1875
What exactly is your question?
"tangokilo" <tk******@ozemail.com.au> wrote in message
news:UN***************@nnrp1.ozemail.com.au...
Hi,
I am failry new to this game and could use some help. Is there an easier
way..?

I get an integer fields from the database indiacting the access rights of a user and I wish to display that on a Windows Form as a group of radio
buttons. Any cnages made to this group should filert back to the database.
I am using Dataset (using stored procedure) to retrieve the data and
objCmd.ExecuteNonQuery to save it back to DB.

Code Snipets to check radio button and the get selected button back:
' Now load radio button

If _UserRole.Rows(0).Item("AccessRights") = 0 Then

RadioBtnAllAccess.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 1 Then

RadioBtnForecastAndReports.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 2 Then

RadioBtnReportsOnly.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 9 Then

RadioBtnNoAccess.Checked = True

End If

-----------------------------------------

' Now get the selected radio button

If RadioBtnAllAccess.Checked Then

Label1.Text = "You selected " & RadioBtnAllAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 0

ElseIf RadioBtnForecastAndReports.Checked Then

Label1.Text = "You selected " & RadioBtnForecastAndReports.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 1

ElseIf RadioBtnReportsOnly.Checked Then

Label1.Text = "You selected " & RadioBtnReportsOnly.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 2

Else

Label1.Text = "You selected " & RadioBtnNoAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 9

End If

Many thanks ,
Thomas

Nov 20 '05 #2
What exactly is your question?
"tangokilo" <tk******@ozemail.com.au> wrote in message
news:UN***************@nnrp1.ozemail.com.au...
Hi,
I am failry new to this game and could use some help. Is there an easier
way..?

I get an integer fields from the database indiacting the access rights of a user and I wish to display that on a Windows Form as a group of radio
buttons. Any cnages made to this group should filert back to the database.
I am using Dataset (using stored procedure) to retrieve the data and
objCmd.ExecuteNonQuery to save it back to DB.

Code Snipets to check radio button and the get selected button back:
' Now load radio button

If _UserRole.Rows(0).Item("AccessRights") = 0 Then

RadioBtnAllAccess.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 1 Then

RadioBtnForecastAndReports.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 2 Then

RadioBtnReportsOnly.Checked = True

ElseIf _UserRole.Rows(0).Item("AccessRights") = 9 Then

RadioBtnNoAccess.Checked = True

End If

-----------------------------------------

' Now get the selected radio button

If RadioBtnAllAccess.Checked Then

Label1.Text = "You selected " & RadioBtnAllAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 0

ElseIf RadioBtnForecastAndReports.Checked Then

Label1.Text = "You selected " & RadioBtnForecastAndReports.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 1

ElseIf RadioBtnReportsOnly.Checked Then

Label1.Text = "You selected " & RadioBtnReportsOnly.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 2

Else

Label1.Text = "You selected " & RadioBtnNoAccess.Text

objcmd.Parameters.Add("@AccessRights", SqlDbType.Int).Value = 9

End If

Many thanks ,
Thomas

Nov 20 '05 #3

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

Similar topics

1
6888
by: Rick | last post by:
After being frustrated with this issue on several occasions I think I found the secret sauce for solving the issue after reading a few different messages about what others thought and trying a...
6
3259
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
1
47833
by: Rage Matrix | last post by:
Hi all, I have a small problem with Access radio button groups in VBA. I've got a radio button group called fraSearchMode with three radio buttons in it. At a certain point, I want to see which...
1
4886
by: Scott D Johnson | last post by:
I am using Visual Studio .NET 2003 (I also have VS .NET 2005 installed) I have a group of four radio buttons, and button, to set the first radio button as checked. When I run the app, and say...
3
31510
by: Sin Jeong-hun | last post by:
Suppose there are 4 radion buttons on the form. There's no groupbox or panel to seperate them. By default, the 4 radio buttons are mutually exclusive. Is it possible to group them into two groups?...
3
18568
by: teddysnips | last post by:
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...
4
13260
by: liltwese | last post by:
Hi, i'm new to VB. I have a problem with de-selecting radio buttons in group box containers. I've tried to set focus to other objects under Sub New (initialization) but it didn't work. The rdo...
7
4851
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio...
4
3982
by: axapta | last post by:
Hi group, How can I group a couple of check boxes on my form so that only ONE can be checked an anytime? I've tried placing them onto a panel but I can still check them both. Using VB.NET...
3
7964
by: DragonLord | last post by:
Ok here is the situation in detail. Single form with multiple items on it, 4 of which are panls that contain radio butons. Each panel loads it's radio buttons from a list of items in a sql...
0
7153
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
7373
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
7432
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...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
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...
0
4743
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...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.