Save filedialog not working

前端 未结 2 1232
一向
一向 2021-01-24 14:32

Bit of an odd one here , I\'m writing an app which gives a save file option , the save file dialog is coded up as normal

SaveFileDialog ofd = new SaveFileDialog         


        
2条回答
  •  攒了一身酷
    2021-01-24 14:58

    Stream stream;
    ofd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"  ;
         ofd.FilterIndex = 2 ;
         ofd.RestoreDirectory = true ;
    
    if(ofd.ShowDialog() == DialogResult.OK)
         {
             if((stream = ofd.OpenFile()) != null)
             {
        //FileStream might be better for you but since i don't know what you write, this will serve as an example
                 stream.Write(bytes,offset,count);
                 stream.Close();
             }
    

提交回复
热议问题