private void btnConvert_Click(object sender, System.EventArgs e) { this.statusBarPanel1.Text = "正在转换,请稍候..."; CSharpToVBConverter o = new CSharpToVBConverter(); this.txtVB.Text = o.Execute(this.txtCSharp.Text); string path = Application.StartupPath; try { //ass.KeyWordFormat(txtVB,"VB",path); } catch {} //Change the Page in the Tab Control so we can see the changes //this.tabControl1.SelectedTab = this.tabControl1.TabPages[1]; this.tabControl1.SelectedIndex = 1; this.statusBarPanel1.Text = "转换完成。"; // try // { // mythread = new Thread(new ThreadStart(ThreadWork)); // mythread.Start(); // } // catch(System.Exception er) // { // MessageBox.Show("转换时发生错误:"+er.Message,"提示",MessageBoxButtons.OK,MessageBoxIcon.Stop); // } }
void ThreadWork() { this.statusBarPanel1.Text = "正在转换,请稍候..."; CSharpToVBConverter o = new CSharpToVBConverter(); this.txtVB.Text = o.Execute(this.txtCSharp.Text); string path = Application.StartupPath; try { //ass.KeyWordFormat(txtVB,"VB",path); } catch {} //Change the Page in the Tab Control so we can see the changes //this.tabControl1.SelectedTab = this.tabControl1.TabPages[1]; this.tabControl1.SelectedIndex = 1; this.statusBarPanel1.Text = "转换完成。"; }