Custom Class

S

shapper

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
 
S

sloan

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.
 
S

shapper

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
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top