L
Larry
I'm having trouble finding the right method to determine at runtime the data
type of the fields in a class.
here's what I've got so far:
Public Class ImgSubmissionRecord
Public fileName As String
Public thumbnail As Bitmap
Public fileSize As Int64
Public fileDate As DateTime
Public disposition As Int16
End Class
Imports System.Reflection
Public Class debugControl
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblDebug As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim anObject As New ImgSubmissionRecord
Dim MemInfo, memInfoArray() As MemberInfo
Dim aType As Type = anObject.GetType
memInfoArray = aType.GetMembers(BindingFlags.Public Or
BindingFlags.Instance)
For Each MemInfo In memInfoArray
Me.lblDebug.Text = Me.lblDebug.Text + "<br>" + MemInfo.Name + "/" +
System.Type.GetType(MemInfo.GetType.ToString).ToString
Next
End Sub
End Class
I get the name for each member of the class ok, but for the type I get
"System.Reflection.RuntimeFieldInfo"
instead of string or int16, or bitmap, or whatever type the member is. How
do I get this information at runtime?
-Larry
type of the fields in a class.
here's what I've got so far:
Public Class ImgSubmissionRecord
Public fileName As String
Public thumbnail As Bitmap
Public fileSize As Int64
Public fileDate As DateTime
Public disposition As Int16
End Class
Imports System.Reflection
Public Class debugControl
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents lblDebug As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim anObject As New ImgSubmissionRecord
Dim MemInfo, memInfoArray() As MemberInfo
Dim aType As Type = anObject.GetType
memInfoArray = aType.GetMembers(BindingFlags.Public Or
BindingFlags.Instance)
For Each MemInfo In memInfoArray
Me.lblDebug.Text = Me.lblDebug.Text + "<br>" + MemInfo.Name + "/" +
System.Type.GetType(MemInfo.GetType.ToString).ToString
Next
End Sub
End Class
I get the name for each member of the class ok, but for the type I get
"System.Reflection.RuntimeFieldInfo"
instead of string or int16, or bitmap, or whatever type the member is. How
do I get this information at runtime?
-Larry