Need best practice on winform components

  • Thread starter Thread starter M O J O
  • Start date Start date
M

M O J O

Hi,

I need a lillte guidance on how to create a simple component and put in
in the toolbox.

Here's how I've done so far, please let me know if there's a better
aproach (I have some question to this aproach later in this post)....

1) I open Vs.net.

2) I create a new "Windows Control Library" called "MyTestLib".

3) I add a new "Component Class" called MyPanel.

4) I fill in the code in MyPanel (derived from Panel).

5) I build the project.

6) I open a new WindwosForms solution.

7) In the toolbox I right-click to add/remove items.

8) In the ".Net Framework Components", I browse to the MyTestLib bin
directory.

9) I select MyTestLib.dll and click open.

10) I check that the MyPanel's checkbox is checked and click ok.


Now my conponent (MyPanel) shows up in the toolbox.


Here's my questions....

1) Is the aproach above the right aproach?

2) If I chose to add a bitmap (embedded resource) for MyPanel (that
means MyPanel.bmp) and rebuilds MyTestLib, how do I get the bitmaps to
show up in the toolbox? Do I really have to remove my old components
from the toolbox and then add them again? Isn't there some kinda refresh?

3) If I add a new component MyTextBox to my library (MyTestLib) and
rebuilds MyTestLib, how do I get the new component to show up on the
toolbox? Do I really have to remove my old components from the toolbox
and then add them again? Isn't there an easier way to add the newly
created component?

Thanks in advance!

M O J O
 
Your approach is sound.

Add this before your class to show a bitmap of your control. Use a 16 x16
bitmap or icon.

Example:
<ToolboxBitmap("C:\Location\MyControl.bmp")> _
Public Class MyControl

'-- Your code

End Class
 
You'll have to reload it again before your new controls show up.
3) If I add a new component MyTextBox to my library (MyTestLib) and
rebuilds MyTestLib, how do I get the new component to show up on the
toolbox? Do I really have to remove my old components from the toolbox
and then add them again? Isn't there an easier way to add the newly
created component?
 
Hi Brian,

Thanks for helping me out!

What do you mean by reload?

Do I really have to open the toolbox, locate my components (MyTestLib),
uncheck their checkmarks, close the toolbox, open the toolbox again,
browse for the same MyTestLib.dll and then chose ok?

Thanks in advance.

M O J O
 
Yes


M O J O said:
Hi Brian,

Thanks for helping me out!

What do you mean by reload?

Do I really have to open the toolbox, locate my components (MyTestLib),
uncheck their checkmarks, close the toolbox, open the toolbox again,
browse for the same MyTestLib.dll and then chose ok?

Thanks in advance.

M O J O
 
Back
Top