c# - Save filedialog not working -
bit of odd 1 here , i'm writing app gives save file option , save file dialog coded normal
savefiledialog ofd = new savefiledialog();
the dialog box comes no problem , clicking save doesn't throw errors no file saved , i'm not sure why , ideas ? i've googled , can't find similar problem
the savefiledialog class doesn't save anything, prompts user choose location , file name save file. job save file
this example extracted msdn link above explains concept
private void button1_click(object sender, system.eventargs e) { stream mystream ; savefiledialog savefiledialog1 = new savefiledialog(); savefiledialog1.filter = "txt files (*.txt)|*.txt|all files (*.*)|*.*" ; savefiledialog1.filterindex = 2 ; savefiledialog1.restoredirectory = true ; if(savefiledialog1.showdialog() == dialogresult.ok) { if((mystream = savefiledialog1.openfile()) != null) { // code write stream goes here. mystream.close(); } } }
Comments
Post a Comment