Tim Huffam

Dotting the I and crossing the T of I.T.

  Home  |   Contact  |   Syndication    |   Login
  152 Posts | 0 Stories | 2311 Comments | 653 Trackbacks

News

Archives

Post Categories

Interesting Blogs/Links

September 2007 Entries

I've read a few articles recently regarding the use of strings with enums - discussing how to access the constant name values or how to set a variable with the correct value when you only have a string value (enum constant name) - and all present somewhat convoluted ways of achieving this. I'm guessing the authors are not aware that the .Net framework provides methods for this - out the box. Hopefully the following code shows how to do this. private enum CarTypes { Lotus = 0, Morgan = 1, Atom = 2...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Doing some winforms dev for a change - and had a need to hide a form, instead of closing it, when the user clicked the standard windows close form button (little cross [x] icon on the top right corner of the form). The solution is to create a handler for the FormClosing event of the form, then force the form to be hidden, then, the important part, cancel the close event... Eg: // Use this event handler for the FormClosing event. private void MyForm_FormClosing(object sender, FormClosingEventArgs...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati