How to Make Website Blocker In VB.NET

Add 1 Button And 1 Text Box
Button 1 = Block












Full Code :


Imports System.IO
Public Class Form1
    Dim path As String
    Dim sw As StreamWriter
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        path = "C:\Windows\System32\drivers\etc\hosts"
        sw = New StreamWriter(path, True)
        Dim sitetoblock As String = (Environment.NewLine & "127.0.0.1 " & TextBox1.Text)
        sw.Write(sitetoblock)
        sw.Close()
        MessageBox.Show("Website Blocked")
    End Sub
End Class

Post a Comment

Note: Only a member of this blog may post a comment.