Class file referencing a function to return a variable RRS feed

  • Question

  • User801447716 posted


    I have a class where I am setting values fro inclusion on other pages,

        Private Shared m_ucToDisplayForApplicant As String
        Public Shared Property ucToDisplayForApplicant() As String
                Return m_ucToDisplayForApplicant
            End Get
            Set(value As String)
                Dim s As String = value
                m_ucToDisplayForApplicant = value
            End Set
        End Property

        Public Shared Function ucType()
            Dim ucTypeToShow As String = HttpContext.Current.Session.Item("SelectedVar")
            Select Case ucTypeToShow 
                Case "1"
                    ucTypeToShow = "ucType1"
                Case "2"
                    ucTypeToShow = "ucType2"
                Case "3"
                    ucTypeToShow = "ucType3"
                Case Else
            End Select
            Return ucTypeToShow
        End Function

    I am trying to use this function to set the value on my pages but the value is always returned null

            ucToDisplayForApplicant = ucType()

    Any help is appreciated.


    Monday, June 27, 2016 2:04 PM

All replies

  • User753101303 posted


    Have you tried the VS debugger to see if the else clause is called? If it not expected to be called you could also thrown an exception to show you run into an unexpected case.

    If not familiar with the debugger see https://msdn.microsoft.com/en-us/library/mt243867.aspx

    Monday, June 27, 2016 2:39 PM