Our Products

C# (C Sharp) - How to use SaveFileDialog to save text files?

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)
 {
	StreamWriter wText =new StreamWriter(myStream);
		
	wText.Write(" your text");

	myStream.Close();
    }
  }
 
Was this example helpful? yes / no
 
Comments

Example information
Example ID: 84
Category: C# (C Sharp)
Date added: 2012-10-30 16:13:51
Views: 1218
Rating (Votes): Example rated 3.4/5.0 (18)

 
<< Go back

Recommended Hosting
Unlimited space and bandwidth, hosting multiple websites on one account and many other features at very competitive pricing.
Why our products?
- We provide the source codes, not encrypted, so you or developers working for you can make modifications in them ...

- All our prices are final, there are no other hidden fees like for example to remove the "powered by" etc.

- We offer free installation and free technical support ...
Become our Partner
1. Join our affiliate program and earn a commission for sales you refer, read more

2. Sell our products under your brand name (with our references removed and your company and product names instead), read more

3. Please contact us to discuss any other partnership ideas you may have