使用浏览器阻止网站 [英] Blocking Websites with Browser

查看:93
本文介绍了使用浏览器阻止网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在浏览器中阻止网站,该网站将被阻止的网站存储在my.settings.blockedwebs(这是collections.specialized.stringcollection)中.我让用户将被阻止的网站输入到form1的文本框中,然后将网站添加到stringcollection 按钮具有以下代码:

I wish to block websites in a browser, where the blocked websites are stored in my.settings.blockedwebs (which is a collections.specialized.stringcollection). I let the user input the blocked website into a textbox in form1, and the add website to the stringcollection button has the following code:

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If My.Settings.BlockedWebs Is Nothing Then
      My.Settings.BlockedWebs = New System.Collections.Specialized.StringCollection
    End If
    My.Settings.BlockedWebs.Add(TextBox1.Text)
    My.Settings.Save()
    TextBox1.Text = ""

然后使用第二个按钮更新列表框(其中包含所有被阻止的网站)

Then a second button is used to update the listbox (which contains all the blocked websites)

  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    For Each a As String In My.Settings.BlockedWebs
      ListBox1.Items.Add(a)
    Next
  End Sub

然后我放


Form1.Label1.Text = Browser.Url.ToString

推荐答案

那么,什么不起作用?您是否已浏览并查看发生了什么?变量a等于b吗?文本框中的字符串是什么?
So, what doesn't work? Did you step through and see what is going on? does the variable a equal b? What string is in the text box?


这篇关于使用浏览器阻止网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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