Form1の全コード
using System;
using System.Windows.Forms;
using System.IO;
namespace FileTest1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
{
using (StreamReader sr = new StreamReader(OpenFileDialog1.FileName))
{
String FirstLine = sr.ReadLine();
String AllLine = FirstLine + "\r\n" + sr.ReadToEnd();
MessageBox.Show(FirstLine, "TEST", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (StreamWriter outfile = new StreamWriter(SaveFileDialog1.FileName))
{
outfile.Write(AllLine);
}
}
}
}
}
}
}