Get Field Names from TypedView

Posts   
 
    
wiredeye
User
Posts: 18
Joined: 15-Jul-2008
# Posted on: 03-Aug-2008 16:25:10   

How do I iterate through a typed view and get the field names? In a Collection class I can do this dim obj as new somecollection for i as integer = 0 to obj.fields.count -1 dim s as obj.fields(i).name do something next

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Aug-2008 20:42:28   

A TypedView has DataColumns, not EntityFields. So, you should do that this way:

Dim theView As New YourViewTypedView()

For Each (c As System.Data.DataColumn In theView.Columns)

     Dim s = c.ColumnName
     ' Do something...

Next
David Elizondo | LLBLGen Support Team
wiredeye
User
Posts: 18
Joined: 15-Jul-2008
# Posted on: 04-Aug-2008 02:21:12   

Thanks! I also found the "GetFields()' Collection.