请高手帮看看 为什么程序会死掉~ 并且数据写不进文本
afeny 2008-03-13 03:16:21 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string x;
x = System.Windows.Forms.Application.StartupPath;
if(false == System.IO.File.Exists(x + "/map/0.map"))
{
MessageBox.Show("请安装在正确目录");
}
FileStream ftp = new FileStream("ftp.ini", FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(ftp);
sw.WriteLine(x + "[Server]", "Servercount", "1");
sw.WriteLine(x + "server1caption", textBox1.Text);
sw.WriteLine(x + "server1name", textBox1.Text);
sw.Flush();
FileStream mir = new FileStream("mir.ini", FileMode.Create, FileAccess.Write);
StreamWriter sw1 = new StreamWriter(mir);
sw1.WriteLine("[setup]", "fontname", FontStyle.Bold);
sw1.WriteLine("SeverAddr", textBox2.Text);
sw1.Flush();
ftp.Close();
mir.Close();
sw.Close();
sw1.Close();
}
}
}