深圳福永外资公司注册:如何在listBox中,跟踪显示程序运行的状态,便于知道程序运行到哪一步了

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 20:57:21
点击一个按钮时,如何在listBox中,跟踪显示程序运行的状态,就像ftp软件状态监视宽中的那样,便于知道程序运行到哪一步了。我的程序如下:
private void button1_Click(object sender, EventArgs e)
{

this.listBox_resout.Items.Insert(0, "数据初始化开始");
myconn.Open();
string sqlstr = "update deviser_talk_label set root_idstr='0,'";
mycmd.Connection = myconn;
mycmd.CommandText = sqlstr;
string z=mycmd.ExecuteNonQuery().ToString();
myconn.Close();
this.listBox_resout.Items.Insert(0, "影响行数:" + z + "");
this.listBox_resout.Items.Insert(0, "数据初始化成功");
this.listBox_resout.Items.Insert(0, "正在显示更改后的结果");
sqlstr = "select talk_label_id,talk_label_name,root_id,root_idstr,talk_label_label from deviser_talk_label order by talk_label_id,root_id ";
dataguid(sqlstr, "right_label", this.dataGridView_label_new , this.label_count_new );
this.listBox_resout.Items.Insert(0, "结果结果显示完毕");
this.listBox_resout.Items.Insert(0, "---------------------");

}
这样运行后,跟踪信息是在点击按钮,到按钮中的程序运行完后,才全部一起的显示出来,而不是时时的,我想要他一条一条的显示出来,而不是等到程序运行完后,才一起显示出来。
跪求高手赐教,

在每次Insert后Refresh
你累不累啊