Usercontrol or Custom control

M

Matt

Hi

I'm developing an application with a tabview. Each tab there are a no: of
controls and control events.
I dont want to keep all tabpages in a single .cs file. Options are to create
usercontrols or custom controls.

I dont know which one to go for.
Also i need designer view to design tabs in Visual studio 2003

What i'm planning is as follows
1. create a Form with tabpages
2. create usercontrol change the folowing
public class UserControl1 : System.Windows.Forms.UserControl
to
public class UserControl1 : System.Windows.Forms.Panel

3. write code for each panel seperately

4. Embed each panel in the each tabpage

Is this solution feasible ? Please suggest

And in future we may remove all the tab pages and go for Explorer view
solution . I dont want to redo the code .

thanks
Matt
 
D

Dmytro Lapshyn [MVP]

Hi Matt,

Given the choice, I'd go for the UserControl (no need to tweak the
inheritance to derive from Panel though). Custom controls are good if you do
a lot of your drawing and there's no need to host child controls. As it
seems to be not your case, you should be just fine with creating a user
control.

Speaking of design-time support, you can open each user control in the
designer and design it like you'd design a form. I am not sure though
whether you can design a user control when it's on a Tab page - most likely
you won't be able to do that, but as long as you can design the control
itself separately, this shouldn't be a big problem.

If you plan to switch to an Explorer view later (I assume it's something
like MMC console trees), you can re-use the same controls to be displayed in
the right pane.
 

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