G
Guest
I am trying to get the properties of a DataTable or DataView using the
following code where obj is an object set to either a DataTable or DataView:
If TypeOf obj Is DataSet Then
myDataList = CType(CType(obj, DataSet).Tables(v_DataMember), _
IListSource).GetList
ElseIf TypeOf obj Is IListSource Then
myDataList = CType(obj, IListSource).GetList
End If
Dim obj As Object = v_DataList.Item(0)
Dim props As PropertyInfo() = myDataList.GetType.GetProperties()
Dim colname as string()
Redim colname(ubound(props)
For i = 0 to ubound(props)
colname(i) = props(i).Name
Next i
I get colname array as follows:
colname(0) = "DataView"
colname(1) = "Item"
colname(2) = "Item"
colname(3) = "Row"
colname(4) = "RowVersion"
colname(5) = "IsNew"
colname(6) = "IsEdit"
Where should be getting:
colname(0) = "Column1"
colname(1) = "Column2"
........
It seemed to work once then I must have changed something because it won't
work anymore. Any suggestions?
following code where obj is an object set to either a DataTable or DataView:
If TypeOf obj Is DataSet Then
myDataList = CType(CType(obj, DataSet).Tables(v_DataMember), _
IListSource).GetList
ElseIf TypeOf obj Is IListSource Then
myDataList = CType(obj, IListSource).GetList
End If
Dim obj As Object = v_DataList.Item(0)
Dim props As PropertyInfo() = myDataList.GetType.GetProperties()
Dim colname as string()
Redim colname(ubound(props)
For i = 0 to ubound(props)
colname(i) = props(i).Name
Next i
I get colname array as follows:
colname(0) = "DataView"
colname(1) = "Item"
colname(2) = "Item"
colname(3) = "Row"
colname(4) = "RowVersion"
colname(5) = "IsNew"
colname(6) = "IsEdit"
Where should be getting:
colname(0) = "Column1"
colname(1) = "Column2"
........
It seemed to work once then I must have changed something because it won't
work anymore. Any suggestions?