Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / June 2007

Tip: Looking for answers? Try searching our database.

Designtime behaviour of a tabcontrol in a usercontrol

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Johnny Kühne - 01 Jun 2007 14:26 GMT
Hello Newsgroup

I'm working with VS 2005 Prof. on a usercontrol, which should look like a
wizzard.

In this usercontrol I have tabcontrol, which should be active in designtime,
so a user can drag other controls on it.
I have achieved this behaviour with a ParentControlDesigner for the
usercontrol and a call of EnableDesignMode für the tabcontrol and each
tabpage.

With a Smart Tag I add new tabpages to the tabcontrol. If I do so, the
usercontrol does not save this pages in the designer file (or any other
controls on this page). Because of that, the usercontrol looses the controls
when reopen the Form. But if I use the Smart Tag of the tabcontrol, the new
pages are stored in the designer file.

Does somebody knows what could be wrong?

Thank you for your answers!
Greetings Johnny
Bryan Phillips - 02 Jun 2007 15:30 GMT
Have you looked at applying the DesignerSerialization attribute to the
property for the tab collection?

--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Blog:  http://bphillips76.spaces.live.com
Web Site:  http://www.composablesystems.net

> Hello Newsgroup
>
[quoted text clipped - 17 lines]
> Thank you for your answers!
> Greetings Johnny
Johnny Kühne - 03 Jun 2007 15:51 GMT
Hi Bryan

Thank you for your answer.
Yes, I tested with "content" and "visible" for the control.

Greetings

> Have you looked at applying the DesignerSerialization attribute to the
> property for the tab collection?
[quoted text clipped - 26 lines]
> > Thank you for your answers!
> > Greetings Johnny
Johnny Kühne - 03 Jun 2007 18:27 GMT
Hi Newsgroup

I finally found the answer on:
http://www.developerfusion.co.uk/show/4665/6/

I simply had added a new tabpage to the control, but I should have used the
CreateComponent method of IDesignerHost:

           Dim h As IDesignerHost =
DirectCast(GetService(GetType(IDesignerHost)), IDesignerHost)
           Dim dt As DesignerTransaction = Nothing
           Dim c As IComponentChangeService =
DirectCast(GetService(GetType(IComponentChangeService)),
IComponentChangeService)

           'Add a new tabpage to the collection
           Dim t As TabPage = Nothing
           dt = h.CreateTransaction("Add Step")
           t = DirectCast(h.CreateComponent(GetType(TabPage)), TabPage)
           t.Text = Replace(Me.jkw.strText_StepTitle, "%nr%",
Me.jkw.tabPages.TabCount)
           c.OnComponentChanging(Me.jkw, Nothing)
           Me.jkw.tabPages.TabPages.Add(t)
           c.OnComponentChanged(Me.jkw, Nothing, Nothing, Nothing)
           Me.jkw.tabPages.SelectedIndex = Me.jkw.tabPages.TabCount - 1
           dt.Commit()

Thank you for your help Brian.

Greetings Johnny

> Hi Bryan
>
[quoted text clipped - 33 lines]
> > > Thank you for your answers!
> > > Greetings Johnny

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.