I am still facing this exception "Current thread must be set to single thread
apartment (STA) mode before OLE calls can be made. Ensure that your
Main function has STAThreadAttribute marked on it. This exception is
only raised if a debugger is attached to the process."
I used code as below:
protected void Button2_Click(object sender, EventArgs e)
{
Stream myStream;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
saveFileDialog1.ShowDialog();
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
Code to write the stream goes here.
myStream.Close();
}
}
}
If anyone can..... Plz help me.
I am using c#.net Web application but i am unable to show file savedialog box...
Thanks in advance.........