Re: Converting enum Keys value to string
- From: "Rob Lans" <rlans(at)competence(dot)biz>
- Date: Thu, 14 Apr 2005 14:30:42 +0200
For enum to int conversion use a cast:
int i = (int)Keys.F10;
Keys k = (Keys)i;
For enum to string conversion:
string s = Keys.F10.ToString();
Keys k = (Keys)Enum.Parse(typeof(Keys), s);
Rob.
"Ahmed" <ahmedbm@xxxxxxxxx> wrote in message
news:1113467832.844421.149470@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am saving the enum value of specific keys to an xml file which i then
> need to get the string representation. I believe KeysConverter is there
> for that but i have trouble using it for my purpose.
> i want to give it a value and have it spit out its Keys equivilancy for
> example.
>
> 121 -> Keys.F10
>
> I am not sure if i am playing with the right function or not but any
> advise or suggestions would be appreciated :)
>
.
- Follow-Ups:
- Re: Converting enum Keys value to string
- From: Ahmed
- Re: Converting enum Keys value to string
- References:
- Converting enum Keys value to string
- From: Ahmed
- Converting enum Keys value to string
- Prev by Date: MenuItem Name
- Next by Date: Re: Register ocx
- Previous by thread: RE: Converting enum Keys value to string
- Next by thread: Re: Converting enum Keys value to string
- Index(es):
Relevant Pages
|