By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,201 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,201 IT Pros & Developers. It's quick & easy.

enumerations as options for a custom function?

P: n/a
Hi,

I was hoping someone could tell me how to declare/create a function so that
when I call for it programatically one of the input parameters appears as a
drop down list of possible options instead of typing in the value.

I believe it has to due with declaring an enumeration but not sure.

Thanks

Chris
Mar 28 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:77**********************************@microsof t.com...
Hi,

I was hoping someone could tell me how to declare/create a function so
that
when I call for it programatically one of the input parameters appears as
a
drop down list of possible options instead of typing in the value.

I believe it has to due with declaring an enumeration but not sure.

Thanks

Chris

// Define enum:

enum MyValue : int {
Value1 = 0,
Value2 = 1,
Value3 = 2,
Value4 = 3,
Value5 = 4
}

public void DoSomething(MyValue Value)
{
switch (Value) {
case MyValue.Value1:
// Do something.
break;

... handle others too ...
}
}

public void SomethingElse()
{
DoSomething(MyValue.Value1);
}
HTH,
Mythran

Mar 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.