Re: Converting enum Keys value to string

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);


"Ahmed" <ahmedbm@xxxxxxxxx> wrote in message
>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 :)


Relevant Pages

  • Re: Nugget - Using control references
    ... until someone decides they want to save a 3D array. ... If the users are likely to add elements to the middle of the enum, you should save and load by the enum text. ... What you can try is this - save both the string and the number. ... Unused keys are not deleted.  When the number of elements in an array is reduced, the key entries still exist in the file. ...
  • Re: Compiling AWK
    ... the term "nil" is used to mean an uninitialized ... results in the length of the string or the number of entries in the table. ... and size arguments specify the least significant bit and size of the field. ... The two table arguments are treated as sets: The keys represent the strings ...
  • Re: Help With PyParsing of output from win32pdhutil.ShowAllProcesses()
    ... None to a string). ... Still have an urge to parse with pyparsing? ... pyparsing Dict class. ... keys from the parsed data, so it looks like you are already thinking ...
  • Re: Merging hashes using both symbols and strings as keys
    ... default values for my class) and the other using strings as keys ... (taken from the params hash). ... the string, ... # the returned hash will also be extended by SymbolizeKeys ...
  • Re: Send a fax from VBA
    ... Public Sub FaxeFeuille(FeuilleAFaxer As String, destinataire As String, ... Dim keys As String ... (This would not be needed if the assistant is already ... > Then you would use the Sendkeys statement to TAB to the required textbox ...