TabPage troubles

Topics: CAB & Smart Client Software Factory
Mar 15, 2006 at 1:06 AM
originally posted by: Rdunzl

I used another approach to get around the problem, but I guess it was because the smartparts wasn't added to the workitem (I created and added them directly in the view's constructor) (hmm this should work shouldn't it? - then I guess that I added them to a non-workspace container control in the view, or something else that must have hid them from the builder or whatever it is...)

Man, CAB will be cool when I fully understand how it works :-P
Mar 15, 2006 at 1:07 AM
originally posted by: Rdunzl

I'm trying to develop an app in VB2005 using CAB(C#). For some reason (I guess it's a bug in VB) my user controls don't show in the toolbox, so I have to add the controls at runtime.

I have a smartview with a tabworkspace on it, and I then add two tabpages in the smartview's constructor:
Dim detailsTab As New System.Windows.Forms.TabPage
Dim detailsView As New CustomerDetailView
detailsView.Dock = DockStyle.Fill
detailsTab.Text = "Data"

Dim eventsTab As New System.Windows.Forms.TabPage
Dim eventsView As New CustomerEventsView
eventsView.Dock = DockStyle.Fill
eventsTab.Text = "Arrangementer"

when I run the app and click on the second tabpage it shows and immediately after the tabworkspace raises a nullreference exception in the protected virtual void OnActivate(Control smartPart).

I guess I add the pages in a wrong way so I'd appreciate any hints on how to do it right.

The the examples in the documentation about the tabpage class seems to belong to a previous version, so I can't get much help from this.
Mar 15, 2006 at 5:07 AM
originally posted by: DLorenz

Yeah... You don't want to run smartparts directly on the TabWorkspace. Instead, you want to use this method on the WorkItem:

Me.Workspaces("NameOfTheWorkspace").Show(Me.SmartParts.AddNew(Of SomeView))

Hope this helps.
Mar 17, 2006 at 12:46 PM
originally posted by: Rdunzl

Yup, thanks for the help.