Hi people,
Necesito crear n dataviews en tiempo de ejecucion.
I need to create "n" DataViews in runtime.
I tried creating an array this way:
Dim LDView As Array = Array.CreateInstance(GetType(DataView), 10)
DSCapit = New DataSet("DS")
LGCap = New DataTable("DT")
Dim cACCOUNT As DataColumn
cACCOUNT = New DataColumn("ACCOUNT")
LGCap.Columns.Add(cACCOUNT)
DSCapit.Tables.Add(LGCap)
but the asignation is not working:
lDView(0) = New DataView(LGCap) '(1)
neither this way :
lDView.SetValue(New DataView(LGCap), 0) '(2)
This two way compilate but then cancel in runtime
in the array asignacion line (1) y (2)
The problem came from my need to create a tabcontrol with
"n" (variable) tabs within it, according to a database table
contents. And within each tab one datagrid with its corresponding
DataView, all created in runtime.
Any ideas?
TIA
Pablo
Cor Ligthert [MVP] - 19 Aug 2005 10:58 GMT
Pablo,
Is this what you want, otherwise describe what why you need those dataviews?
Dim LDView(myTabControl.tabcount) As DataView
Dim DSCapit As New DataSet("DS")
Dim LGCap As New DataTable("DT")
LDView(0) = New DataView(LGCap) '(1)
I hope this helps,
Cor
Cor Ligthert [MVP] - 19 Aug 2005 11:12 GMT
Pablo,
Forget this part in the sentence from me. When I was answering your question
I had seen you did that, therefore I could make this snippet. However
forget to delete this. Your problem was well described.
> describe what why you need those dataviews?
Cor