EDN Admin
Well-known member
when i want to replace a file that i opened but i get an error on the under lined code when i try
<pre class="prettyprint private void button2_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.txt (text file)|*.txt";
if (ofd.ShowDialog() == DialogResult.OK)
{
ObjStream = new StreamReader(ofd.FileName);
input1.Text = ObjStream.ReadToEnd();
}
}
catch (Exception ect)
{
MessageBox.Show("an error has occured: " + ect.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "*.txt (text file)|*.txt";
if (sfd.ShowDialog() == DialogResult.OK)
{
<span style="text-decoration:underline input1.SaveFile(sfd.FileName, RichTextBoxStreamType.PlainText);
}
}[/code]
<br/>
View the full article
<pre class="prettyprint private void button2_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.txt (text file)|*.txt";
if (ofd.ShowDialog() == DialogResult.OK)
{
ObjStream = new StreamReader(ofd.FileName);
input1.Text = ObjStream.ReadToEnd();
}
}
catch (Exception ect)
{
MessageBox.Show("an error has occured: " + ect.Message);
}
}
private void button3_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "*.txt (text file)|*.txt";
if (sfd.ShowDialog() == DialogResult.OK)
{
<span style="text-decoration:underline input1.SaveFile(sfd.FileName, RichTextBoxStreamType.PlainText);
}
}[/code]
<br/>
View the full article