multithreading - F# saveFileDialog -


i'm trying save file using savefiledialog in f#. far i've looked @ this post , tried rewrite , other code on net. i've read bit savefiledialogs on msdn.

i think code should work reason crashes (if press continue in ide can glimpse of savefiledialog wrong type-filter).

my crash message "an exception of type 'system.threading.threadstateexception' occurred in system.windows.forms.dll not handled in user code"

and code is:

let savefile = new savefiledialog()     savefile.filename <- "my sudoku.txt"     savefile.filter <- "text files (*.txt)|*.txt|all files (*.*)|*.*";     savefile.initialdirectory <- directory.getcurrentdirectory ()     savefile.filterindex <- 1   if savefile.showdialog(new form(text="save", topmost=true, width=360, height=390)) = system.windows.forms.dialogresult.ok                                           savefile    (savefile.initialdirectory) (savefile.filename) (stufftosave)                                          else printfn "error couldn't save"  

the code happening in form named createmode started async.

async.start(createmode observables sudokugame) ; gui.create.form.showdialog()  

a way fix have discovered add open system program. , add

[<stathreadattribute>]     

before async.start part starts thread program.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -