帮助,Web浏览器tabcontrol超出范围 [英] Help, web browser tabcontrol is out of range

查看:100
本文介绍了帮助,Web浏览器tabcontrol超出范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,当我使用visual studio / basic制作标签式网页浏览器时,我启动它,这个错误出现了:



hello, when i make a tabbed web browser with visual studio/basic, and i start it, this error shows up:

Index 0 out of range
Parameter name: index

ArgumentOutOfRangeException was unhandled









这是我添加标签的代码:







this is my code to add tabs:

Dim wb As New WebBrowser
       TabControl1.TabPages.Add(1)
       TabControl1.SelectedTab.Controls.Add(wb)
       wb.Dock = DockStyle.Fill
       TabControl1.TopLevelControl.TabIndex = False







这是我的导航代码:






and this is my code to navigate:

CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(ComboBox1.Text)







导航仅适用于第一个选项卡





有人可以帮帮我吗?谢谢




navigating only works on the first tab


Can someone help me, please? Thanks

推荐答案

这是因为 Item(0)当项目数为零时抛出异常。您需要在按索引引用之前检查计数。



另外, TabPages.Add(1) make没有意义。你需要添加一个字符串(标签标题),而不是整数。



-SA
This is because Item(0) throws exception when the number of items is zero. You need to check up for count before referencing by index.

Also, TabPages.Add(1) makes no sense. You need to add a string (tab title), not an integer.

—SA


这篇关于帮助,Web浏览器tabcontrol超出范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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