Custom SaveAs Dialog

Hi
I had made a little application that can save data in ASCII or Binary format. I wish to let user choose the format at runtime. But I read the it's impossible to extend the SaveDialog control in the .Net Framework. And I don't find a way to add a radio button to let user choose the format.
Is someone know a way to do something like this? Or maybe there is already a custom made control that do this somewhere on the Internet.
Thank you
[456 byte] By [Esquif] at [2007-12-16]
# 1
So that to be complicated the life?

I understand that you wish to use radiobuttons to choose the format to keep, but the SaveDialog allows you to specify the elements that you wish to store in the drop-down list of formats.



[Visual Basic]
Protected Sub button1_Click(sender As Object, e As System.EventArgs)
Dim myStream As Stream
Dim saveFileDialog1 As New SaveFileDialog()

saveFileDialog1.Filter = "txt files (*.txt)|*.txt|Bin files (*.bin)|*.bin"
saveFileDialog1.FilterIndex = 2
saveFileDialog1.RestoreDirectory = True

If saveFileDialog1.ShowDialog() = DialogResult.OK Then
myStream = saveFileDialog1.OpenFile()
If Not (myStream Is Nothing) Then
'Code to write the stream goes here
myStream.Close()
End If
End If
End Sub



[C#]
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream ;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.bin)|*.bin" ;
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();
}
}
}

Another alternative that you have is to create your own window to save, and to invoke it when the user chooses the respective command.

Regards

CFQüeb at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms Designer...