I have a hashtable that I pass into a session. I use a function to get the value back out of the hashtable in the session.
I have to cast everything to a string when i pass it to the hashtable but when I get the value back out of the hashtable from the session i know what datatype i want to pass it back as.
So i pass into the function the Key and the returned DataType. The problem i am having is the CType will not allow for my variable that tells it what type to return. It keeps telling me that it is not a type.
I even tried passing in a type from a function.
Public Shared Function ConfigSetting( _
ByVal columnName As String, _
ByVal returnDataType As String) As Object
Dim ht As New Hashtable
ht = HttpContext.Current.Session("ConfigSettings")
Dim myValue = ht(columnName)
Dim convertType As System.Type = GetTypeByName(returnDataType.Trim)
Return CType(columnValue, convertType)
Public Shared Function GetTypeByName(ByVal TypeName As String) As Type
Dim AssemblyName As String = "System.Type"
Dim oAssembly As [Assembly]
oAssembly = [Assembly].Load(AssemblyName)
Return oAssembly.GetType(TypeName, True, True)