title: F# saveFileDialog
body: <p>I'm trying to save a file using saveFileDialog in F#. So far I've looked at <a href="https://stackoverflow.com/questions/5136254/saving-file-using-savefiledialog">this post</a> and tried to rewrite that and other code on the net. I've also read a bit about saveFileDialogs on msdn.</p>
  
  <p>I Think that my code should work but for some reason it crashes (if I press continue in the IDE I can even get a glimpse of the saveFileDialog but with wrong type-filter). </p>
  
  <p>My crash message is "An exception of type 'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll but was not handled in user code"</p>
  
  <p>and my code is:</p>
  
  <pre><code>let savefile = new SaveFileDialog()
      savefile.FileName &lt;- "My Sudoku.txt"
      savefile.Filter &lt;- "Text files (*.txt)|*.txt|All files (*.*)|*.*";
      savefile.InitialDirectory &lt;- Directory.GetCurrentDirectory ()
      savefile.FilterIndex &lt;- 1 
  
  if savefile.ShowDialog(new Form(Text="Save", TopMost=true, Width=360, Height=390)) = System.Windows.Forms.DialogResult.OK 
                                           then saveFile    (savefile.InitialDirectory) (savefile.FileName) (stuffToSave)
                                           else printfn "Error couldn't save" 
  </code></pre>
  
  <p>The code is actually happening in a form named createMode which is started with async.</p>
  
  <pre><code>Async.Start(createMode observables sudokuGame) ; GUI.Create.form.ShowDialog() 
  </code></pre>