my code stock.com

Snippet options

Download: Download snippet as ip.vbs.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

Imports System.Net.Mail
Public Class Form1
    Dim message As New MailMessage
    Dim smtp As New SmtpClient
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim husam As New System.Net.WebClient
        Dim ip As String
        ip = System.Text.Encoding.ASCII.GetString((husam.DownloadData("http://icanhazip.com/")))
        Label3.Text = ip
        If CheckBox1.Checked = True Then
            message.From = New MailAddress("tucorreo")
            message.To.Add(TextBox2.Text)
            message.Body = Label3.Text
            message.Subject = "IP"
            smtp.EnableSsl = True
            smtp.Port = "587"
            smtp.Host = "smtp.live.com"
            smtp.Credentials = New Net.NetworkCredential("tucorreo", "tucontraseña")
            smtp.Send(message)
            MsgBox("Correo enviado exitosamente")
        End If

        If CheckBox2.Checked = True Then
            Timer1.Enabled = True
        End If

    End Sub

    Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then TextBox2.ReadOnly = False
        If CheckBox1.Checked = True Then TextBox2.Text = ("")
        If CheckBox1.Checked = True Then LinkLabel1.Visible = True
        If CheckBox1.Checked = True Then CheckBox2.Visible = True
        If CheckBox1.Checked = False Then TextBox2.Text = ("Bloqueado")
        If CheckBox1.Checked = False Then TextBox2.ReadOnly = True
        If CheckBox1.Checked = False Then CheckBox2.Visible = False
        If CheckBox1.Checked = False Then LinkLabel1.Visible = False
        End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        message.From = New MailAddress("[email protected]")
        message.To.Add(TextBox2.Text)
        message.Body = Label3.Text
        message.Subject = "IP"
        smtp.EnableSsl = True
        smtp.Port = "587"
        smtp.Host = "smtp.live.com"
        smtp.Credentials = New Net.NetworkCredential("[email protected]", "matias1994")
        smtp.Send(message)
        MsgBox("Correo enviado exitosamente")
    End Sub

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        MsgBox("Al activar esta opción no debes cerrar el programa")
    End Sub
End Class

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.