MDI Application + Dataset Problem
Posted on 2006-07-20
I'm reworking an existing (and working) vb.net application.
Until now I had a TreeList and two Datagrids (plus other stuff) on the same window.
I want to rework that do an MDI application so the user is more free to arrange the above elements/components on his screen (or ist there another solution than MDI to do that).
I have now a main form that opens some MDI forms like this:
Dim frmProductsTreelist As New ProductsTreelist
frmProductsTreelist.MdiParent = Me
Now I have a problem that I get a (runtime) error when I try to assign a datasource (ds) that has loaded data from an external source and is located in the Main window to the Treelis on the Child Window:
frmProductsTreelist.TreeList1.DataSource = CreateFilteredView(ds.Tables("Categories"), "[f4] = 1")
It also does not work without the FilteredView Part:
frmProductsTreelist.TreeList1.DataSource = ds.Tables("Categories")
Im getting a runtime error that says:
object variable or with block variable not set
Also all other operations that try to do something with the data on the Main Form on one of the Child Forms do not work, like
frmProductsTreelist.TreeList1.KeyFieldName = "f1"
All code listed here is running in the MainForm.
(I'm using Devexpress Components, but I guess that does not matter)
As I said this worked when everything was on the same form/window.
I'm pretty stuck with my work...