可以把要输出提示写入到文本文件中 C#追加文件 方法 注意要在加入 using System.io;
StreamWriter sw = File.AppendText(Server.MapPath(".")+"\\myText.txt");
sw.WriteLine("追逐理想");
sw.WriteLine("kzlll");
sw.WriteLine(".NET笔记");
sw.Flush();
sw.Close(); 各种文本操作方法教程 http://apps.hi.baidu.com/share/detail/24500086给你一些有用的教程http://blog.sina.com.cn/s/blog_640ff1510100mz9n.htmlhttp://wenku.baidu.com/view/ba76ea0b79563c1ec5da71cb.html
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 btnStart_Click(object sender, EventArgs e)
{
int i = 0;
string message = "";
try
{
i = 5 / i;
}
catch(Exception a)
{
message = a.Message.ToString();
} FileStream fs = new FileStream("E:/错误提示.txt",FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(message);
sw.Close();
fs.Close();
}
}
}