UserControl purpose question ...

  • Thread starter Thread starter Jamie Risk
  • Start date Start date
J

Jamie Risk

I'm implementing a Windows application in C# .Net 2.0. On many
of the forms I need to have record navigation capabilities
(forwards, backwards, first, last etc) which I chose a to do
with a toolbar containg 7 buttons or so.

1. Rather than recreating the same toolbar (navBar) in the dozen
or so locations I need it, is this a case where I could use
the UserControl?

2. Regardless, is it a simple matter to make the UserControl
accessible in the forms design mode?

Thanks,

- Jamie
 
In this case easier way is to subclass form with toolbar.

Suppose you create form with toolbar ToolForm. Derive your other forms from
it.

class MyNewForm : ToolForm {
....
}

You might need to add properties to ToolForm to get to events for toolbar
buttons, but it should not cause any difficulties.

UserControl itself is placeholder where you put additional controls. Then
you should put it on corresponding form. Slightly more and unnecessarily
complex for your case and with design hassles (positioning, attaching events
etc.).

HTH
Alex
 
Back
Top