In C #, you can express characters for an event KeyPressin a form Keys.Control | Keys.M. In F #, it Keys.Control ||| Keys.Mdoes not work. What is he doing?
Change . Interesting. The use System.Windows.Forms.Keys.Control ||| System.Windows.Forms.Keys.Mas suggested by Johannes Rössel below in the F # interactive window works exactly as it shows. By writing it to the .fs file:
form.KeyPress.Add (fun e ->
if (e.KeyChar = (System.Windows.Forms.Keys.Control ||| System.Windows.Forms.Keys.M)) then textbox.SelectAll() )
gives an error The type 'char' does not support any operators named '|||'. Therefore, I probably misidentified the location of the problem. Type from Keysto char does not exist.
source
share