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

Custom Class

Hello,

I am trying to create a custom email class but this one is the first
class I create.
Where can I find some tips of how to create classes?

I have various problems. For example, there are properties which, when
not defined by the user it won't be used on my code:

Public WriteOnly Property Priority() As System.Net.Mail.MailPriority
Set(ByVal value As System.Net.Mail.MailPriority)
If _Priority = value Then
Return
End If
_Priority = value
End Set
End Property

Is the user doesn't set Priority then in my function I will not have:

email.Priority = ...

Of course I could use an IF condition around "email.Priority = ..." but
I am not sure if that's the way.

Thanks,
Miguel

Sep 27 '06 #1
3 1217

You give it a default value.

private _Priority as System.Net.Mail.MailPriority =
System.Net.Mail.MailPriority.Normal
''//Put this under the class declaration, as a Member Variable

also,

_priority
_mailPriority
m_priority

any of these would be a more consistent member variable name.

"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to create a custom email class but this one is the first
class I create.
Where can I find some tips of how to create classes?

I have various problems. For example, there are properties which, when
not defined by the user it won't be used on my code:

Public WriteOnly Property Priority() As System.Net.Mail.MailPriority
Set(ByVal value As System.Net.Mail.MailPriority)
If _Priority = value Then
Return
End If
_Priority = value
End Set
End Property

Is the user doesn't set Priority then in my function I will not have:

email.Priority = ...

Of course I could use an IF condition around "email.Priority = ..." but
I am not sure if that's the way.

Thanks,
Miguel

Sep 27 '06 #2
Do you know any URL with Tips of how to create classes?

An one more question:
How to make a property to assume only certain values.

For example, the user, would write:
..Send = ...

And it would have only to options:
"Now" or "InOneDay"

Something like:
System.Net.Mail.MailPriority.Normal
System.Net.Mail.MailPriority.High
....

Thanks,
Miguel

sloan wrote:
You give it a default value.

private _Priority as System.Net.Mail.MailPriority =
System.Net.Mail.MailPriority.Normal
''//Put this under the class declaration, as a Member Variable

also,

_priority
_mailPriority
m_priority

any of these would be a more consistent member variable name.

"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,

I am trying to create a custom email class but this one is the first
class I create.
Where can I find some tips of how to create classes?

I have various problems. For example, there are properties which, when
not defined by the user it won't be used on my code:

Public WriteOnly Property Priority() As System.Net.Mail.MailPriority
Set(ByVal value As System.Net.Mail.MailPriority)
If _Priority = value Then
Return
End If
_Priority = value
End Set
End Property

Is the user doesn't set Priority then in my function I will not have:

email.Priority = ...

Of course I could use an IF condition around "email.Priority = ..." but
I am not sure if that's the way.

Thanks,
Miguel
Sep 27 '06 #3
You create your own enum class.

http://www.google.com/search?hl=en&q=vb.net+%22enum%22
You can find some "classes" at
http://sholliday.spaces.live.com/?_c...26ayear%3d2006

1.1 downloadable code.


"shapper" <md*****@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
Do you know any URL with Tips of how to create classes?

An one more question:
How to make a property to assume only certain values.

For example, the user, would write:
.Send = ...

And it would have only to options:
"Now" or "InOneDay"

Something like:
System.Net.Mail.MailPriority.Normal
System.Net.Mail.MailPriority.High
...

Thanks,
Miguel

sloan wrote:
You give it a default value.

private _Priority as System.Net.Mail.MailPriority =
System.Net.Mail.MailPriority.Normal
''//Put this under the class declaration, as a Member Variable

also,

_priority
_mailPriority
m_priority

any of these would be a more consistent member variable name.

"shapper" <md*****@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hello,
>
I am trying to create a custom email class but this one is the first
class I create.
Where can I find some tips of how to create classes?
>
I have various problems. For example, there are properties which, when
not defined by the user it won't be used on my code:
>
Public WriteOnly Property Priority() As System.Net.Mail.MailPriority
Set(ByVal value As System.Net.Mail.MailPriority)
If _Priority = value Then
Return
End If
_Priority = value
End Set
End Property
>
Is the user doesn't set Priority then in my function I will not have:
>
email.Priority = ...
>
Of course I could use an IF condition around "email.Priority = ..."
but
I am not sure if that's the way.
>
Thanks,
Miguel
>

Sep 27 '06 #4

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

Similar topics

3
by: Neil Zanella | last post by:
Hello, In Python, classes are objects. But there is no way to custom print a class object. This would require some syntax such as the one commented out below: With the current "foo =...
4
by: Steve Amey | last post by:
Hi all I am creating a basic control to perform some tasks, and I want to declare some events to be raised so they can be handled from the form that the control is on. I can create my own Event...
7
by: Luc Tremblay | last post by:
Given the typical following code: void Listener::HandleEvent(const Event& event) { // handling code } In a "clean" fashion, how is it possible to add custom data (to be subsequently...
6
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base...
6
by: Steve Amey | last post by:
Hi all I want to be able to throw a custom error up the call stack. I have looked around and it seems as though it's possible, but I can't get it to work :o( Below is some sample code. ...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.