Happy Friday all!
I have a little bit of code I need help with. I am extracting the name of a radio button and passing that name to a subroutine to pull out the BaseName to turn on some other forms and text boxes. I am having a prob using Me.Controls and exceptions.
My form control is not becoming visible and for some reason I cannot execute without the Try and Catch. Sample passed value would be SuicideRDB
I have a little bit of code I need help with. I am extracting the name of a radio button and passing that name to a subroutine to pull out the BaseName to turn on some other forms and text boxes. I am having a prob using Me.Controls and exceptions.
My form control is not becoming visible and for some reason I cannot execute without the Try and Catch. Sample passed value would be SuicideRDB
Code:
Sub CheckValue(RBName As String)
Dim BaseName As String
Dim CtrlName As Control
Dim FindInt As Integer
Dim MyVal As Integer
If RBName.Substring(Math.Max(0, RBName.Length - 1)) <> "0" Then
MyVal = RBName.Substring(Math.Max(0, RBName.Length - 1))
FindInt = InStr(1, RBName, "RDB")
BaseName = RBName.Substring(0, FindInt - 1)
CtrlName = Me.Controls("lbl" & BaseName & "Num")
Try
CtrlName.Visible = True
Catch ex As Exception
'CtrlName = Me.Controls("table" & BaseName)
'CtrlName.Visible = True
'Catch ex As Exception
End Try
End If
End Sub