C
Cade Carvell
Hello,
I am trying to copy a datacolumn from a good table, and append it to
an incoming table that needs to be modified. This incoming table has
data, and I would rather not copy each property one by one, Is thier a
way to get the propertyinfo stuff to work were I can read the property
of a datacolumn, and set it on a new datacolumn...Here is were I am at
in Code:
If Not (TBL.Columns.Contains(DC.ColumnName)) Then
Dim DCNEW As New DataColumn
Dim T As Type
T = DC.GetType
Dim Pi As System.Reflection.PropertyInfo
For Each Pi In
T.GetProperties(System.Reflection.BindingFlags.Public Or
System.Reflection.BindingFlags.Instance)
Dim result As Object
If Pi.CanWrite Then
Try
result = Pi.GetValue(DC,
System.Reflection.BindingFlags.Public Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetProperty,
Nothing, Nothing, Nothing)
'********Now that I havge the result, how do I get it
back into the new datacolumn?
Catch
Debug.WriteLine(Pi.Name & " = " & "Can't get Value")
End Try
End If
Next
TBL.Columns.Add(DC)
End If
Thanks to anyone who can help me with this.
Cade
I am trying to copy a datacolumn from a good table, and append it to
an incoming table that needs to be modified. This incoming table has
data, and I would rather not copy each property one by one, Is thier a
way to get the propertyinfo stuff to work were I can read the property
of a datacolumn, and set it on a new datacolumn...Here is were I am at
in Code:
If Not (TBL.Columns.Contains(DC.ColumnName)) Then
Dim DCNEW As New DataColumn
Dim T As Type
T = DC.GetType
Dim Pi As System.Reflection.PropertyInfo
For Each Pi In
T.GetProperties(System.Reflection.BindingFlags.Public Or
System.Reflection.BindingFlags.Instance)
Dim result As Object
If Pi.CanWrite Then
Try
result = Pi.GetValue(DC,
System.Reflection.BindingFlags.Public Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.GetProperty,
Nothing, Nothing, Nothing)
'********Now that I havge the result, how do I get it
back into the new datacolumn?
Catch
Debug.WriteLine(Pi.Name & " = " & "Can't get Value")
End Try
End If
Next
TBL.Columns.Add(DC)
End If
Thanks to anyone who can help me with this.
Cade