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