Re: [VB6 ] 在 WebBrowser 中呼叫程式裡的Function …

看板Visual_Basic作者 (guest)時間17年前 (2008/04/23 22:54), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串1/1
※ 引述《Mitnick (-..---.--...---..-.-)》之銘言: : 請問要如何在 WebBrowser (IE) 裡呼叫 VB 程式裡的 Function 或 Sub : 假設我在程式裡有一個按鈕叫 Command1,一個 WebBrowser 叫 Web1 : 然後我將 Web1 填入了一個連結的 HTML Code : With Web1 : .Navigate "about:blank" : .Document.open : .Document.write "<a href=""#######"">Call Command1</a>" : .Document.Close : End With : 希望做到能夠在按下該連結時,能夠呼叫VB程式中的 Command1 : 請問有解決的方法嗎? : 感謝 :) 先抓取 <A> 物件, 然後連結Click事件到 Command1 的 EventHandler Web1.Document.GetElementsByTagName("a")(0). _ AttachEventHandler("onclick", AddressOf Command1_Click) Private Sub Command1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Command1.Click MessageBox.Show("Hello World") End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.127.41.107

04/24 10:01, , 1F
謝謝您,這個方式在 VB.NET 是正常的
04/24 10:01, 1F

04/24 10:01, , 2F
那請問在VB6該怎麼做呢
04/24 10:01, 2F
文章代碼(AID): #183qsEeV (Visual_Basic)