Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic DataColumn-Array 1

Status
Not open for further replies.

Seelenfieber

Programmer
Nov 29, 2006
6
DE
I'd like to set Relations with more than one Datacolumn
in my Dataset between Datatables.

dim Col as DataColumn()
Col = New DataColumn() {DataSet1.Tables(tvSel.Nodes(1).Text).Columns(0), DataSet1.Tables(tvSel.Nodes(1).Text).Columns(1)}

Static constructor of the Datacolumn-array is no problem.
Now I need a dynamic init of this Datacolumn()
because I don't know how much columns are affected.

Any way to build a String and evaluate it or other idea?

Thanks for reply
 
Will this work for you? Good Luck!
Code:
Dim Col As DataColumn() = GetDataColumnArray(DataSet1.Tables(tvSel.Nodes(1).Text))

Private Function GetDataColumnArray(ByVal table As DataTable) As DataColumn()
    Dim dataColumns(table.Columns.Count - 1) As DataColumn
    For index As Integer = 0 To table.Columns.Count - 1
        dataColumns(index) = table.Columns(index)
    Next
    Return dataColumns
End Function 'GetDataColumnArray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top