我使用WebBrowser來搜尋網頁,但遇到URL解碼的問題,
像是輸入"我喜歡你"編譯成網頁code後會是 "%RTYUIJKHJK"
底下這份程式,就是在幹這件事情
重點在於
Dim escapeDataString As String = Uri.EscapeDataString(str)
Sub LoadWeb() txtWebsite.Text = "" Dim str As String = txtSearch.Text 'EscapeDataStringでURLエンコードする Dim escapeDataString As String = Uri.EscapeDataString(str) Dim ulr As String = "https://www.google.com.tw/search?q=" & escapeDataString & "&hl=zh-TW&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjQgqjRxfrhAhWQyYsBHdsdChwQ_AUIDigB&biw=1280&bih=619" Dim dateyear As String = "https://www.google.com.tw/search?q=" & escapeDataString & "&client=opera&tbas=0&tbm=isch&sxsrf=ACYBGNS2YHnxCtiPY4uCixVaYO-XF4M7zQ:1569827326912&source=lnt&tbs=qdr:y&sa=X&ved=0ahUKEwjMpLfB_vfkAhWiyIsBHQiNCNYQpwUIIw&biw=1280&bih=618&dpr=1.25" If CheckBox1.Checked Then txtContent.Text = "" txtWebsite.Text = dateyear Else txtContent.Text = "" txtWebsite.Text = ulr End If Me.WebBrowser1.Navigate(txtWebsite.Text) End Sub
文章標籤
全站熱搜
留言列表