第2个回答 2009-12-04
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace save
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void save()
{
string filePath = @"D:\test.txt";
string txt = TextBox.Text;
File.WriteAllText(filePath, txt, Encoding.Default);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
save();
}
}
}