473,414 Members | 1,643 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,414 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 1872
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: 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
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
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
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
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
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,...
0
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...
0
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...

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.