T
tangokilo
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
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