473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Need best practice on winform components

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
4 1359
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ken | last post by:
How can I have my WinForm return something to the caller so it knows which button is clicked? The following is calling a system message box, just want to do the samething with my own winform....
3
by: cbrown | last post by:
I am rebuilding an existing application that relies on an SQL DB. The app is a scheduling/employee management program. My question pertains to best practices in dotnet and database. I use a 3...
8
by: redeagle | last post by:
I'm wondering what the best practice is for creating a WinApp "wizard" that contains 4 or 5 "steps". Options so far are 1) Single WinForm making various controls visible/non visible at the...
29
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
3
by: Torben Laursen | last post by:
I have a COM shared add-in written in C# that I use in Excel. One of the thinks that the user can do is to open some winforms. The problem that I have is that the first time the user opens a...
3
by: sloan | last post by:
Probably an easy question but here goes: A 2.0 winform. How (on startup) should I properly make the width, the max of the user's screen? ...
19
by: Daniel Pitts | last post by:
I have std::vector<Base *bases; I'd like to do something like: std::for_each(bases.begin(), bases.end(), operator delete); Is it possible without writing an adapter? Is there a better way? Is...
6
by: Peter Larsen [CPH] | last post by:
Hi, I'm looking for some "best practice" help related to web applications and recources (images, strings, files etc). In Windows Forms Applications its normal to save all kinds of resources in...
41
by: =?Utf-8?B?VGltIE1hcnNkZW4=?= | last post by:
Hi, I am after suggestions on the best practice declaring and destroying objects. some example code: Private Sub MySub Dim frmMyForm As MyForm Try
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.