i can save a file using savefiledialog . once the file is saved and if we edit it and then save it again then it should be saved without opening the savefiledialog.please help me with the code.
This code is made in Visual Studio 2005 in Windows forms.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace win
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
StreamReader str = new StreamReader(openFileDialog1.FileName);
textBox1.Text = str.ReadToEnd();
str.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
{
StreamWriter wtr = new StreamWriter(saveFileDialog1.FileName);
wtr.Write(textBox1.Text);
wtr.Close();
}
}
}
}
}