一个超级简单的文件流操作WINDOW应用程序
一直都没写过windows应用程序,今天写了几个操作文件的,非常简单:
Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.ShowDialog();
this.textBox1.Text = this.openFileDialog1.FileName;
}
private void button2_Click(object sender, EventArgs e)
{
this.folderBrowserDialog1.SelectedPath = Application.StartupPath;
this.folderBrowserDialog1.ShowDialog();
this.textBox2.Text = this.folderBrowserDialog1.SelectedPath;
}
private void button3_Click(object sender, EventArgs e)
{
if(this.textBox2.Text.Trim()!="")
{
System.Diagnostics.Process.Start(this.textBox2.Text);
}
}
private void button4_Click(object sender, EventArgs e)
{
string _fileName = "\\shine.txt";
string _text = this.textBox3.Text;
_fileName = this.textBox2.Text+_fileName;
System.IO.StreamWriter sw = new System.IO.StreamWriter(_fileName);
sw.Write(_text);
sw.Close();
this.Close();
}
}
}