Question Adding preset option to functions, methods.

thinmg

New member
Joined
Jul 20, 2009
Messages
2
Programming Experience
1-3
Hi.
I'm trying to create classes, functions, etc that present a preset list of options to users (in the same way that messagebox control will show the available button options). A simple example is readFile(ByVal strPath as string, ByVal strFileType as string) where the user will see a list of acceptable file types when they put the comma after strPath.
My first post so please be gentle if I'm just being stupid :)
 
Last edited:
What you're talking about is an enumeration, e.g. the MessageBoxButtons enumeration that you mentioned. It might look like this:
VB.NET:
Public Enum FileType
    Text
    Image
    Executable
End Enum
or like this:
VB.NET:
Public Enum FileType
    Txt
    Jpeg
    Bmp
    Exe
End Enum
FileType is then a type like any other, so your second parameter would be declared as that type rather than String.
 
Re Question - adding preset option

Thanks jmcilhinney!
It works a treat. I had looked at Enum but the blinkers were obviously well on and I'd taken a good smack from the stupid stick!
 
Back
Top