C#文件操作实例大全
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace 学¡ì生¦¨²成¨¦绩¡§管¨¹理¤¨ª模¡ê拟a
{
public partial class 文?件t操¨´作Á¡Â : Form
{
FileObj myFileObj = new FileObj();
public 文?件t操¨´作Á¡Â()
{
InitializeComponent();
}
private void 文?件t操¨´作Á¡Â_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
label1.Text =
myFileObj.GetPostfixStr(openFileDialog1.FileName);
}
private void button2_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
myFileObj.WriteFile(saveFileDialog1.FileName, textBox1.Text);
}
private void button3_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
textBox2.Text = myFileObj.ReadFile(openFileDialog1.FileName);
}
private void button4_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
myFileObj.FileAdd(openFileDialog1.FileName, textBox1.Text);
}
private void button5_Click(object sender, EventArgs e)
{
try
{
评论0