问题描述
setText()没有调用,但是对话框出来了,请问为什么?多谢:)usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingmshtml;usingSHDocVw;namespaceWindowsApplication{publicpartialclassForm1:Form{staticprivateSHDocVw.InternetExplorerm_IExplorer=null;staticprivateIWebBrowserAppm_WebBrowser=null;publicForm1(){InitializeComponent();m_IExplorer=newSHDocVw.InternetExplorer();SetAllEvents();m_WebBrowser=(IWebBrowserApp)m_IExplorer;m_WebBrowser.Visible=true;m_WebBrowser.GoHome();}voidSetAllEvents(){if(m_IExplorer!=null){m_IExplorer.DocumentComplete+=newDWebBrowserEvents2_DocumentCompleteEventHandler(m_IExplorer_DocumentComplete);}}voidm_IExplorer_DocumentComplete(objectpDisp,refobjectURL){MessageBox.Show("hello");setText();//thrownewException("Themethodoroperationisnotimplemented.");}publicvoidsetText(){this.textBox1.Text=DateTime.Now.ToShortTimeString();}}}
解决方案
解决方案二:
筒子们帮帮忙