Problem creating "n" DataViews

  • Thread starter Thread starter Pablo
  • Start date Start date
P

Pablo

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top