Hi all,

I want to know some details about savefiledialog.... can a form be opened on clicking the save button in savefiledialog...

If yes can some one provide the idea or code...


Thanks
vince

Here is one simple example:

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 to write the stream goes here.
             myStream.Close();
         }
     }
 }

Save does normally what it says: save.
It's like you would say to an iDoor (a smartDoor :) ) Door Open and the door closes... That would be rather weird don't you think?

Hmm maybe I misunderstood, I assumed he meant he wanted to show a dialog when pressing the save button but before the savefiledialog exited.

<shrug>

no i was planning for something else...like loading a file with the contents of a listview(which are checked). so what i do is on click of a button savefiledialog opens after giving the name to the file... press the save button..this save button click has to open the form containing the listview in which i select the rows to be saved,... my idea is weird but like to implement it....

If u ppl have any other idea your welcome....

thanks for your interest

make a save button on clicking it first open the form to collect the values and information to be stored and after completing this procedure show the savefiledialog to save the file i think this will solve your issue of opening form on save event

thanks for that reply... i'm doing that idea

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.