- private void Save_Click(object sender, EventArgs e)
- {
- string filePath = txtFilePath.Text;
- if (!File.Exists(filePath))
- {
- FileStream fs = File.Create(filePath);
- fs.Close();
- }
- using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
- {
- using (StreamWriter sw = new StreamWriter(fs))
- {
- foreach (string line in employeeList.Items)
- {
- sw.WriteLine(line);
- }
- }
- }
- }
- string path = txtFilePath.Text;
- // This text is added only once to the file.
- if (!File.Exists(path))
- {
- using (StreamWriter sw = File.CreateText(path))
- {
- foreach (var line in employeeList.Items)
- sw.WriteLine(line.ToString());
- }
- }
- else
- {
- using (StreamWriter sw = File.AppendText(path))
- {
- foreach (var line in employeeList.Items)
- sw.WriteLine(line.ToString());
- }
- }
- public void Save_Click(object sender, EventArgs e)
- {
- StreamWriter file =
- new StreamWriter(txtFilePath.Text, true);//Open and append
- foreach (object item in employeeList.Items) {
- file.WriteLine(item.toString());
- }
- file.Close();
- }
Tuesday, 31 July 2012
save file without using save file dialog
Subscribe to:
Post Comments (Atom)
Popular Posts
-
File name: Ashli Orion and Georgia Jones part2.wmv Size: 188.90 MB Type: .wmv Source: http://w...
-
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JF...
-
Warning: This story contains fluffies, violence and human tragedy. Viewer discretion is advised. I don't even like c...
-
CheckBox chb = new CheckBox(); chb.InputAttributes.Add("value", "my_id_00"); chb.Text = "Title 00"; ...
-
import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Point; import ja...
-
HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://simonexxx.no-ip.info/ilMercatinoDelxxx/Mod...
-
http://ul.to/so1xzfnd/Various Artists - Who Owns the Game? [iTunes Plus AAC M4A].rar http://imgchili.com/show/13303/13303501_who...
-
// the lines from which will be read $lines = "1 5 16 26"; // split these numbers above into an array $lines...
-
"30 Meters " + raw("²") def area_conversion(feet, project) if project.metric ...
-
private void Save_Click(object sender, EventArgs e) { string filePath = txtFilePath.Text; if (!Fi...
No comments:
Post a Comment