473,396 Members | 1,693 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,396 software developers and data experts.

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 1869
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
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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.