By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Need best practice on winform components

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:Om*************@tk2msftngp13.phx.gbl...
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

Nov 20 '05 #2

P: n/a
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?
"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:Om*************@tk2msftngp13.phx.gbl... 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

Nov 20 '05 #3

P: n/a
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


Brian wrote:
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?



"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:Om*************@tk2msftngp13.phx.gbl...


Nov 20 '05 #4

P: n/a
Yes
"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
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


Brian wrote:
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?



"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message news:Om*************@tk2msftngp13.phx.gbl...

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.