VB.NET调用IE,并且等待

             Dim  p  As   New  Process
            ' 获得URL
            aURL  =  GetURL()
            
' 获得IE路径
            p.StartInfo.FileName  =  System.Environment.GetFolderPath( _
                Environment.SpecialFolder.ProgramFiles).Trim() _
                
&   " \Internet Explorer\IEXPLORE.EXE "
            p.StartInfo.Arguments = aDenURL
             ' 启动IE
            'p.Start(aDenURL)
            p.Start()
            
' 主程序开始等待IE结束
            p.WaitForExit()

另一种方法
Imports  System.Threading    
Private   Sub  Button1_Click( ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs)  Handles  Button1.Click
        
Dim  webobj  As   Object
        webobj 
=   CreateObject ( " InternetExplorer.Application " )

        
With  webobj
            .visible 
=   True
            .Navigate2(
" http://www.google.co.jp/ " )
            
Do   While  (.busy  Or  .readyState  <>   4 )
                Thread.Sleep(
100 )
            
Loop
            .Document.f.q.Value 
=   Me .TextBox1.Text
            .Document.f.btng.Click()
        
End   With
        
MsgBox ( " completed. " )
    
End Sub

你可能感兴趣的:(VB.NET)