如何在切换选项卡时更新文本框中的URL在vb.net中 [英] how to update url in the textbox when switching tabs In vb.net

查看:81
本文介绍了如何在切换选项卡时更新文本框中的URL在vb.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签式网页浏览器,它的工作正常,但我有一个问题,那就是如果我打开一个新标签是好的,但如果我回到上一个标签,urltextbox它有标签最后打开标签中的网址。

所以如果你有解决方案我正在向你寻求帮助

解决方案

这对你有帮助。 链接 [ ^ ]


< blockquote>谢谢你,但我得到了答案,这是







< br /> 
Private Sub TabControl1_SelectedIndexChanged(sender As Object,e As EventArgs)Handles TabControl1.SelectedIndexChanged< br />
< br />
'抓取Web浏览器控件在此选项卡上并读取其URL属性< br />
'注意,只希望获得一个浏览器控件。< br />
< br />
每个wb作为WebBrowser在TabControl1.SelectedTab.Controls.OfType(Of WebBrowser)中(< br />
urlTextBox.Text = wb.Url.ToString< br />
Next< br />
End Sub< ; br />







以上确实假设你只有每个TabPage上有一个WebBrowser控件。如果不是这种情况,还有其他方法可以找到WebBrowser控件。


I have a tabbed web browser its working fine , but i have a little problem and that is if i open a new tab is ok but if i go back to previous tab the urltextbox it have the url in the tab last opened tab.
so i am asking you for help if you have the solution

解决方案

This help you. Link[^]


thank you any way but i got the answer and it is



<br />
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs)      Handles TabControl1.SelectedIndexChanged<br />
<br />
    'Grab the Web Browser control on this tab and read its URL property<br />
    'NOTE, only expect to get one browser control.<br />
<br />
    For Each wb As WebBrowser In TabControl1.SelectedTab.Controls.OfType(Of WebBrowser)(<br />
        urlTextBox.Text = wb.Url.ToString<br />
    Next<br />
End Sub<br />




The above does assume that you would only have one WebBrowser control on each TabPage. There are other ways of finding the WebBrowser control if this is not the case.


这篇关于如何在切换选项卡时更新文本框中的URL在vb.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆