Click here to Skip to main content
15,903,362 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralXP look needed in vb applications Pin
FASTian26-Feb-04 3:06
FASTian26-Feb-04 3:06 
GeneralRe: XP look needed in vb applications Pin
Niels Penneman26-Feb-04 21:42
Niels Penneman26-Feb-04 21:42 
QuestionPassword viewer??? Pin
erikkloeze25-Feb-04 21:37
erikkloeze25-Feb-04 21:37 
AnswerRe: Password viewer??? Pin
Dave Kreskowiak26-Feb-04 2:09
mveDave Kreskowiak26-Feb-04 2:09 
GeneralDeclaring Custom Variables/Properties Pin
Codemonkey8525-Feb-04 13:31
Codemonkey8525-Feb-04 13:31 
GeneralRe: Declaring Custom Variables/Properties Pin
John Kuhn25-Feb-04 14:07
John Kuhn25-Feb-04 14:07 
GeneralRe: Declaring Custom Variables/Properties Pin
Codemonkey8510-Mar-04 12:14
Codemonkey8510-Mar-04 12:14 
GeneralRe: Declaring Custom Variables/Properties Pin
John Kuhn10-Mar-04 13:44
John Kuhn10-Mar-04 13:44 
Well, you could do a couple of things. You could have an Enum in your project, like:

Namespace Munchkin
    Public Enum Genders
        Male
        Female
    End Enum
End Namespace

Then, you could declare your Gender field like:

Public Gender As Genders

And the only valid thing to put in it would be:

someCharacter.Gender = Genders.Male


You could do the same thing with levels, or you could throw an exception if a character's level is set below 1 or above 10:

Public Class Character
    Private _level As Integer
    Public Property Level() As Integer
        Get
            Return _level
        End Get
        Set(ByVal Value As Integer)
            If Value < 1 Or Value > 10 Then
                Throw New ApplicationException("Level must be between 1 and 10")
            Else
                _level = Value
            End If
        End Set
    End Property
End Class


But guess what? Your Character is starting to sound more like a class than a structure...


What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
GeneralRe: Declaring Custom Variables/Properties Pin
Codemonkey8511-Mar-04 4:58
Codemonkey8511-Mar-04 4:58 
GeneralRe: Declaring Custom Variables/Properties Pin
John Kuhn12-Mar-04 2:51
John Kuhn12-Mar-04 2:51 
GeneralVB Script Password InputBox Pin
morde1ac25-Feb-04 9:47
morde1ac25-Feb-04 9:47 
GeneralRe: VB Script Password InputBox Pin
Dave Kreskowiak25-Feb-04 13:00
mveDave Kreskowiak25-Feb-04 13:00 
GeneralDriving a motor Pin
Looping_Eagle25-Feb-04 6:56
Looping_Eagle25-Feb-04 6:56 
GeneralRe: Driving a motor Pin
Dave Kreskowiak25-Feb-04 8:51
mveDave Kreskowiak25-Feb-04 8:51 
GeneralCRC32 Pin
johnjsm25-Feb-04 5:24
johnjsm25-Feb-04 5:24 
GeneralRe: CRC32 Pin
Dave Kreskowiak25-Feb-04 7:13
mveDave Kreskowiak25-Feb-04 7:13 
GeneralRe: CRC32 Pin
johnjsm25-Feb-04 22:17
johnjsm25-Feb-04 22:17 
GeneralRe: CRC32 Pin
Dave Kreskowiak26-Feb-04 1:24
mveDave Kreskowiak26-Feb-04 1:24 
GeneralRe: CRC32 Pin
johnjsm26-Feb-04 5:24
johnjsm26-Feb-04 5:24 
GeneralRe: CRC32 Pin
Dave Kreskowiak26-Feb-04 8:27
mveDave Kreskowiak26-Feb-04 8:27 
GeneralRe: CRC32 Pin
johnjsm4-Mar-04 4:28
johnjsm4-Mar-04 4:28 
GeneralRe: CRC32 Pin
Dave Kreskowiak4-Mar-04 5:45
mveDave Kreskowiak4-Mar-04 5:45 
GeneralRe: CRC32 Pin
r i s h a b h s26-Feb-04 19:07
r i s h a b h s26-Feb-04 19:07 
GeneralRe: CRC32 Pin
Dave Kreskowiak27-Feb-04 4:13
mveDave Kreskowiak27-Feb-04 4:13 
GeneralRe: CRC32 Pin
johnjsm29-Feb-04 1:52
johnjsm29-Feb-04 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.