473,396 Members | 2,029 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,396 software developers and data experts.

Put this code in a Class?

I'm very new to VB.Net and am struggling with the concept of classes and when
to use them. I have found some coding to email exceptions to myself that
might occur in this project I'm developing. I would like to make this coding
available to other projects that I will be developing in the future. Should
this coding go into a class? Actually I've done this already and it seems to
work pretty slick. I linked the class to my project and I assume I can link
it to other projects (but I haven't tried that yet).

Is a class the best place for this kind of code? If not, what is?

Thanks for any help or advice.

Dec 12 '07 #1
5 1166
On 2007-12-12, EManning <EM******@discussions.microsoft.comwrote:
I'm very new to VB.Net and am struggling with the concept of classes and when
to use them. I have found some coding to email exceptions to myself that
might occur in this project I'm developing. I would like to make this coding
available to other projects that I will be developing in the future. Should
this coding go into a class? Actually I've done this already and it seems to
work pretty slick. I linked the class to my project and I assume I can link
it to other projects (but I haven't tried that yet).

Is a class the best place for this kind of code? If not, what is?

Thanks for any help or advice.
If you want to use it in multiple projects, then I would suggest making
it a public class in a class library project... Then you just have to
reference the dll, in any project you want to use it from, and it's
available to you.

--
Tom Shelton
Dec 12 '07 #2
This might be a dumb question but a "class library project" would be a
project that contains several classes, all of which could be accessed by
other projects. Correct?

Thanks for your help, Tom.

"Tom Shelton" wrote:
On 2007-12-12, EManning <EM******@discussions.microsoft.comwrote:
I'm very new to VB.Net and am struggling with the concept of classes and when
to use them. I have found some coding to email exceptions to myself that
might occur in this project I'm developing. I would like to make this coding
available to other projects that I will be developing in the future. Should
this coding go into a class? Actually I've done this already and it seems to
work pretty slick. I linked the class to my project and I assume I can link
it to other projects (but I haven't tried that yet).

Is a class the best place for this kind of code? If not, what is?

Thanks for any help or advice.

If you want to use it in multiple projects, then I would suggest making
it a public class in a class library project... Then you just have to
reference the dll, in any project you want to use it from, and it's
available to you.

--
Tom Shelton
Dec 12 '07 #3
On 2007-12-12, EManning <EM******@discussions.microsoft.comwrote:
This might be a dumb question but a "class library project" would be a
project that contains several classes, all of which could be accessed by
other projects. Correct?

Thanks for your help, Tom.
Yep. You've got it.

--
Tom Shelton
Dec 12 '07 #4
Some other things to think about while building a DLL/Class Library.

Keep in mind the scope of classes, subs, functions. Make things private,
friend, protected, and only public when needed.
Using MS FXCop against your code and reading about the items flagged can
help you learn a lot...

I would read a few atricles on OO:

Introduction to VB.NET Object Oriented
http://www.ondotnet.com/pub/a/dotnet...oo.html?page=1

Schneider


"EManning" <EM******@discussions.microsoft.comwrote in message
news:0F**********************************@microsof t.com...
I'm very new to VB.Net and am struggling with the concept of classes and
when
to use them. I have found some coding to email exceptions to myself that
might occur in this project I'm developing. I would like to make this
coding
available to other projects that I will be developing in the future.
Should
this coding go into a class? Actually I've done this already and it seems
to
work pretty slick. I linked the class to my project and I assume I can
link
it to other projects (but I haven't tried that yet).

Is a class the best place for this kind of code? If not, what is?

Thanks for any help or advice.

Dec 12 '07 #5
Thanks everyone for your replies. I have trouble understanding the
difference between classes and functions and where to use them. Maybe I'll
understand better after I've used classes for a while.

Thanks again.
"schneider" wrote:
Some other things to think about while building a DLL/Class Library.

Keep in mind the scope of classes, subs, functions. Make things private,
friend, protected, and only public when needed.
Using MS FXCop against your code and reading about the items flagged can
help you learn a lot...

I would read a few atricles on OO:

Introduction to VB.NET Object Oriented
http://www.ondotnet.com/pub/a/dotnet...oo.html?page=1

Schneider


"EManning" <EM******@discussions.microsoft.comwrote in message
news:0F**********************************@microsof t.com...
I'm very new to VB.Net and am struggling with the concept of classes and
when
to use them. I have found some coding to email exceptions to myself that
might occur in this project I'm developing. I would like to make this
coding
available to other projects that I will be developing in the future.
Should
this coding go into a class? Actually I've done this already and it seems
to
work pretty slick. I linked the class to my project and I assume I can
link
it to other projects (but I haven't tried that yet).

Is a class the best place for this kind of code? If not, what is?

Thanks for any help or advice.


Dec 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dafella | last post by:
The following is code from Xeoport. It is suppose to access my pop3 account and load email into Mysql database. It's not inserting and there is no log or anything to tell me why. Here is the...
51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
1
by: Alex Clark | last post by:
Hi all, Apologies for the cross-post but I can't determine if this is a VS .NET problem or a VB.NET language issue. I'm using .NET 1.1 SP1, VS 2003 EA, VB.NET. I'm coding a custom component...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
7
by: praveenb000 | last post by:
Hi, every one on this forum.... I am new to web designing (using HTML/CSS). i designed a web page using HTML, Css with dream weaver. Here is the code i used for the desinging. it appears well...
3
by: knkk | last post by:
I am trying to include this code in the footer.template files of all blog templates: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." :...
70
mideastgirl
by: mideastgirl | last post by:
I have recently been working on a website for an honors association, and have a lot of difficulty but have found help from those on this site. I would like to see if I can get some more help on a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.