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

Creating Custom Libraries

P: n/a
I'm coming from C++ programming 5 years ago into VB.NET, so please be
patient with me. In C++, I was able to create a "library" of functions
and procedures that I would commonly use in various projects and
simply "include" them when compiled. In my VB.Net web applications, I
have several functions and methods that I will call on each page, but
I don't want to copy and paste it for each page that uses it. Because
then I may have to change something a dozen times and that is not
manageable. I've searched MSDN and various Usenet groups, but nothing
comes up which means I am probably using the wrong words to describe
the problem. Could someone point me in the right direction? Thanks in
advance...

-A
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Aaron,

You will probably want to build a class library (File, New, Project, Class
Library). Build your classes with their members here and compile it. Then
you can add that assembly ("library") as a reference to your web application
by right-clicking on Reference and adding. It will come up with a list of
assemblies from the Global Access Cache. Down below it has a button to
browse for an assembly. Find and select your assembly and click OK and you
will see it listed under References in your web application now. Now in
your code-behind classes for your web aspx pages, you can:

Private objMyStuff As New MyAssembly.MyClass

and access all the members just as you would in any other library.

HTH,

Raymond Lewallen

"Aaron" <el*********@yahoo.com> wrote in message
news:a4**************************@posting.google.c om...
I'm coming from C++ programming 5 years ago into VB.NET, so please be
patient with me. In C++, I was able to create a "library" of functions
and procedures that I would commonly use in various projects and
simply "include" them when compiled. In my VB.Net web applications, I
have several functions and methods that I will call on each page, but
I don't want to copy and paste it for each page that uses it. Because
then I may have to change something a dozen times and that is not
manageable. I've searched MSDN and various Usenet groups, but nothing
comes up which means I am probably using the wrong words to describe
the problem. Could someone point me in the right direction? Thanks in
advance...

-A

Nov 20 '05 #2

P: n/a
Aaron,

You will probably want to build a class library (File, New, Project, Class
Library). Build your classes with their members here and compile it. Then
you can add that assembly ("library") as a reference to your web application
by right-clicking on Reference and adding. It will come up with a list of
assemblies from the Global Access Cache. Down below it has a button to
browse for an assembly. Find and select your assembly and click OK and you
will see it listed under References in your web application now. Now in
your code-behind classes for your web aspx pages, you can:

Private objMyStuff As New MyAssembly.MyClass

and access all the members just as you would in any other library.

HTH,

Raymond Lewallen

"Aaron" <el*********@yahoo.com> wrote in message
news:a4**************************@posting.google.c om...
I'm coming from C++ programming 5 years ago into VB.NET, so please be
patient with me. In C++, I was able to create a "library" of functions
and procedures that I would commonly use in various projects and
simply "include" them when compiled. In my VB.Net web applications, I
have several functions and methods that I will call on each page, but
I don't want to copy and paste it for each page that uses it. Because
then I may have to change something a dozen times and that is not
manageable. I've searched MSDN and various Usenet groups, but nothing
comes up which means I am probably using the wrong words to describe
the problem. Could someone point me in the right direction? Thanks in
advance...

-A

Nov 20 '05 #3

P: n/a
Addition to Aaron answer:

For source libraries (non compiled):
Create as many Classes, Modules, or what ever you need
Place your libraries in your personal Library path
When you need to use them add them as a link to you project

For compiled libraries (probably dlls)
Compile your libraries
Place your libraries in your personal Library path
In the Object Browser use customize to add "#includes"
or
in the Solution Explorer window right click References and Add what
ever you wish
WARNING:
Using DLLs probably will allow other people to use your libraries.
Can you answer my question in the thread:
C to VB: meaning of ":" is structures
?
Thanks
Raymond Lewallen wrote:
Aaron,

You will probably want to build a class library (File, New, Project, Class
Library). Build your classes with their members here and compile it. Then
you can add that assembly ("library") as a reference to your web application
by right-clicking on Reference and adding. It will come up with a list of
assemblies from the Global Access Cache. Down below it has a button to
browse for an assembly. Find and select your assembly and click OK and you
will see it listed under References in your web application now. Now in
your code-behind classes for your web aspx pages, you can:

Private objMyStuff As New MyAssembly.MyClass

and access all the members just as you would in any other library.

HTH,

Raymond Lewallen

"Aaron" <el*********@yahoo.com> wrote in message
news:a4**************************@posting.google.c om...
I'm coming from C++ programming 5 years ago into VB.NET, so please be
patient with me. In C++, I was able to create a "library" of functions
and procedures that I would commonly use in various projects and
simply "include" them when compiled. In my VB.Net web applications, I
have several functions and methods that I will call on each page, but
I don't want to copy and paste it for each page that uses it. Because
then I may have to change something a dozen times and that is not
manageable. I've searched MSDN and various Usenet groups, but nothing
comes up which means I am probably using the wrong words to describe
the problem. Could someone point me in the right direction? Thanks in
advance...

-A



Nov 20 '05 #4

P: n/a
Addition to Aaron answer:

For source libraries (non compiled):
Create as many Classes, Modules, or what ever you need
Place your libraries in your personal Library path
When you need to use them add them as a link to you project

For compiled libraries (probably dlls)
Compile your libraries
Place your libraries in your personal Library path
In the Object Browser use customize to add "#includes"
or
in the Solution Explorer window right click References and Add what
ever you wish
WARNING:
Using DLLs probably will allow other people to use your libraries.
Can you answer my question in the thread:
C to VB: meaning of ":" is structures
?
Thanks
Raymond Lewallen wrote:
Aaron,

You will probably want to build a class library (File, New, Project, Class
Library). Build your classes with their members here and compile it. Then
you can add that assembly ("library") as a reference to your web application
by right-clicking on Reference and adding. It will come up with a list of
assemblies from the Global Access Cache. Down below it has a button to
browse for an assembly. Find and select your assembly and click OK and you
will see it listed under References in your web application now. Now in
your code-behind classes for your web aspx pages, you can:

Private objMyStuff As New MyAssembly.MyClass

and access all the members just as you would in any other library.

HTH,

Raymond Lewallen

"Aaron" <el*********@yahoo.com> wrote in message
news:a4**************************@posting.google.c om...
I'm coming from C++ programming 5 years ago into VB.NET, so please be
patient with me. In C++, I was able to create a "library" of functions
and procedures that I would commonly use in various projects and
simply "include" them when compiled. In my VB.Net web applications, I
have several functions and methods that I will call on each page, but
I don't want to copy and paste it for each page that uses it. Because
then I may have to change something a dozen times and that is not
manageable. I've searched MSDN and various Usenet groups, but nothing
comes up which means I am probably using the wrong words to describe
the problem. Could someone point me in the right direction? Thanks in
advance...

-A



Nov 20 '05 #5

P: n/a
In response to the first reply:
I do not have the option to choose "Class Library" when I open a new
project. I am running VS .NET 2003 but a class library isn't on the
list. Is there another option? Or how can I add that feature?

To the second reply:
Where would I find my "personal Library Path" and how do I link to it
within the code? As to your other thread, I don't have an answer for
you... sorry

-A

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #6

P: n/a
In response to the first reply:
I do not have the option to choose "Class Library" when I open a new
project. I am running VS .NET 2003 but a class library isn't on the
list. Is there another option? Or how can I add that feature?

To the second reply:
Where would I find my "personal Library Path" and how do I link to it
within the code? As to your other thread, I don't have an answer for
you... sorry

-A

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #7

P: n/a
Wow, moving from C++ to VB.NET? Brave, very brave. Anyhew, File > New
Project there you can select a Library. Shouldn't have changed for 2k3. You can do the same if you want to add it to your current soluton, right
click on the solution > Add > New Project. One thing to remember, you can't
export functions from managed code, so no nifty API programming, but, you
can create a plugin system using either Interfaces or Late-binding. Not on
your topic, but something to think about if you're used to making libraries
with C++.
My first comment is because I started out in VB6, then moved to VB.NET,
and now am trying to learn some stuff I need to accomplish in unmanaged
code, so C++ is my choice, but, damn there's alot of stuff in there! LOL

Anyhew, hope this helps,
Sueffel

"Aaron Asbra" <el*********@ihatespam.com> wrote in message
news:ep**************@TK2MSFTNGP11.phx.gbl... In response to the first reply:
I do not have the option to choose "Class Library" when I open a new
project. I am running VS .NET 2003 but a class library isn't on the
list. Is there another option? Or how can I add that feature?

To the second reply:
Where would I find my "personal Library Path" and how do I link to it
within the code? As to your other thread, I don't have an answer for
you... sorry

-A

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #8

P: n/a
Wow, moving from C++ to VB.NET? Brave, very brave. Anyhew, File > New
Project there you can select a Library. Shouldn't have changed for 2k3. You can do the same if you want to add it to your current soluton, right
click on the solution > Add > New Project. One thing to remember, you can't
export functions from managed code, so no nifty API programming, but, you
can create a plugin system using either Interfaces or Late-binding. Not on
your topic, but something to think about if you're used to making libraries
with C++.
My first comment is because I started out in VB6, then moved to VB.NET,
and now am trying to learn some stuff I need to accomplish in unmanaged
code, so C++ is my choice, but, damn there's alot of stuff in there! LOL

Anyhew, hope this helps,
Sueffel

"Aaron Asbra" <el*********@ihatespam.com> wrote in message
news:ep**************@TK2MSFTNGP11.phx.gbl... In response to the first reply:
I do not have the option to choose "Class Library" when I open a new
project. I am running VS .NET 2003 but a class library isn't on the
list. Is there another option? Or how can I add that feature?

To the second reply:
Where would I find my "personal Library Path" and how do I link to it
within the code? As to your other thread, I don't have an answer for
you... sorry

-A

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.