.NET newbie : control for VB.NET and VC.NET

M

Maileen

Hi,

When i work with C++ builder i've created my own control (component
visual or not visual).

I would like to do the same under MS VB.NET but i've never done it.

Here are the thing that i would like to do :
1. control has to work under VB.NET and VC.NET. Which technology should
be used in this case ?
2. I would like to make this visual control appear in my toolbox, so
waht have i to do for that ?
 
L

Larry Serflaten

Maileen said:
When i work with C++ builder i've created my own control (component
visual or not visual).

I would like to do the same under MS VB.NET but i've never done it.

Here are the thing that i would like to do :
1. control has to work under VB.NET and VC.NET. Which technology should
be used in this case ?

Use VS.Net (Visual Studio). Any language will do as long as you remain CLS compliant.
(Look in the AssemblyInfo file of your project)
2. I would like to make this visual control appear in my toolbox, so
waht have i to do for that ?

Start a new project, select the standard 'Windows Application' type. To that solution,
Add another project, but select the 'Windows Control Library' type. (Use appropreate
names for the projects, ex: TestApp, and FlatButtonControl etc. ;-)

Build your control to some workable state (give it some functionality to get started)
and then go to your application project and add a reference to its Reference
list. In the Reference dialog, choose the Projects tab, where your User control project
should be listed. Adding that reference should add the user control to your toolbox
in the My User Controls section. From there you can use it like any other control and
can put the finisheing touches on your control.

Once done with the control, configure (the UC project) for a Release build, and build
the project. Then copy that .dll to a safe place that will accessable from your other
projects. When you want to add that control your later projects, you again have to
add a reference to it, only this time it will be from the .Net tab in the Reference dialog,
and you may have to Browse to the location where you put it.

LFS
 
G

Guest

Larry, very much appreciate the plain and simple instructions for adding new
controls. It answers a lot of questions I had. However, I was a bit unclear
on one of your points;

"Start a new project, select the standard 'Windows Application' type. To
that solution, add another project, but select the 'Windows Control Library'
type. (Use appropreate"

Do you mean by "add another project" to add a New Item then slect Windows
Control Library? If not, how do i add another project to my current project?
Would appreciate any clarification you can provide on this point. Thanks
again.
 
G

Guest

Larry, I got the new project figured out. However, just adding a reference
to the project doesn't make the control show up in the toolbox user control
tab in Vs.Net 2003. What I had to do :

Create User Control

1. Start Vs.Net 2003 and Select New Project
2. Select Windows Control LIbrary
3. Name your control library and enter the directory for stroing your
project..select OK
4. Go to Solution Explorer and open the control name .vb file.
5. Change the Class Name and/or the Inheirits statment to whatever control
you want to inheirit from.
6. Select from main menu "File" - "Add Project" - "New Project"
7. Select Windows Application and enter name and directory of your new
project which will be used to test the new control.

8. From Solution Explorer, click on your new control name.vb module to bring
up the edit screen for the code.
9. Select from main menu - "Build" - Rebuild "Control name"
10. Select the testform design from the solutoin explorer so it's displayed.
11. Show the ToolBox and right click on "User Control" and select
"Add/Remove Items"
12. Select the Browse button and find the directory and "bin" subdirectory
of your User Control Project.
13. Select the Control name .dll then the Ok button
14. Your new control should show up on the User controls tab of the tool
box. You can then add it to your testform as you would any other control
 

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