App with forms as tabs

T

Tom

I'd like to create a new VB 2005 app that looks like the VS 2005 IDE -
in other words, an app that has multiple forms, but instead of
displaying them seperately or in an MDI main from, I'd rather display
them in tabs across the screen. I might have functions that are
available to the app in the tree view on the left, then as they select
functions it would open them in a new tab... again, almost exactly as
the VB IDE does.

My question therefore really is: Can we display Windows Forms forms in
tabs?

Tom
--
 
T

Tom

Marina: Unfortunately, that isn't really what I 'want' to do. I want to
convert an application I already coded over to this 'Visual Studio IDE'
type format. This app has 50 or so already coded forms - I really don't
want to try to convert EVERY one of those forms over to a user
control!! That would take awhile and probably cost too much for our
company to 'approve'.

Isn't there any way to display an already-created form in a tab? How
does the VS IDE do it?

Tom
 
S

Simon Verona

I'm sure it's the same in vb2005, in vb2003 you do :

dim myform as new frmToGoOnTab
frm.toplevel=false
tabpage1.controls.add(frm)
frm.dock=DockStyle.Fill ' Expands the form to fill the tabpage
frm.show


hth
Simon
 
H

Herfried K. Wagner [MVP]

Simon Verona said:
I'm sure it's the same in vb2005, in vb2003 you do :

dim myform as new frmToGoOnTab
frm.toplevel=false
tabpage1.controls.add(frm)
frm.dock=DockStyle.Fill ' Expands the form to fill the tabpage
frm.show

.... but this could cause focus/tab order problems.
 
S

Simon Verona

Herfried,

I use this technique pretty regularly without any noticeable issues (except
a little screen flickering sometimes as it loads the form).

What sort of focus/tab order issues can occur? I find that once you click
into the form on the tab, the tab order in the "sub-form" is as would be
expected, though of course it won't tab back through the hosting form
without you clicking elsewhere.

Nevertheless, it's a useful way of hosting a form on a tabpage (also works
for panels etc) - I use this technique quite extensively to dynamically load
"forms" into panels and tabcontrols depending on logic within the code.
Usercontrols obviously work better if coding from scratch..

Something else I didn't mention in my original reply is that it looks better
if you hide the controlbox, and the title bar on the form when it's
displayed - it looks a bit stupid otherwise!

Regards
Simon
 
P

Pritcham

Hi

I came across the following yesterday funnily enough - looks like it's
exactly what you're looking for - I've downloaded the source but not
had a chance to look over it as of yet but looks quite promising (The
developer also has a template you can download called something like
"Application Explorer" which looks like it goes even further towards
what you're trying to achieve.

http://www.cflashsoft.com/progs/mdiwinman/

Hope it helps
Martin
 
S

Simon Verona

I use a similar technique using a toolbar on the MDI parent, which
dynamically loads up the mdi children as you click the buttons. The
software link you gave me does the same thing but using "tabs".

If you wanted to have a "tabbed" control which hosted sub-forms, then this
might do the trick for the OP. I have a suspicion that it would...

Regards
Simon
 
M

Marina Levit [MVP]

Why would it take a long time? A usercontrol is really just a form that
can't be displayed on a form, but needs to be in another container. I would
imagine in most cases it should be trivial to convert.

In any case, it sounds like the other solution proposed will work for you.
 
T

Tom

Thanks to everyone for their suggestions! I tried the original code
snippet by Simon and it does work well... However, am going to look at
this DockPanel and MDIWinMan suites - they look like exactly what I was
looking for!

Thanks again!

Tom
 

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

Top