my code stock.com

Snippet options

Download: Download snippet as ip-final.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 Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MsgBox("Si encuentra algún problema por favor reportarlo a [email protected]")
        Dim husam As New System.Net.WebClient
        Dim ip As String
        ip = System.Text.Encoding.ASCII.GetString((husam.DownloadData("http://icanhazip.com/")))
        Label1.Text = ip
        If CheckBox1.Checked = False Then CheckBox2.Visible = False
        If CheckBox1.Checked = True Then CheckBox2.Visible = True
        If CheckBox1.Checked = False Then TextBox1.Visible = False
        If CheckBox1.Checked = True Then TextBox1.Visible = True
        If CheckBox1.Checked = False Then ProgressBar1.Visible = False
        If CheckBox1.Checked = True Then ProgressBar1.Visible = True
        If CheckBox1.Checked = False Then Me.Height = 117
        If CheckBox1.Checked = True Then Me.Height = 281
        If CheckBox1.Checked = True Then TextBox1.ReadOnly = False
        If CheckBox1.Checked = True Then TextBox1.Text = ""
        If CheckBox1.Checked = False Then TextBox1.ReadOnly = True
        If CheckBox1.Checked = False Then TextBox1.Text = "Bloqueado"
        If CheckBox1.Checked = True Then Button1.Visible = True
        If CheckBox1.Checked = False Then Button1.Visible = False
        If CheckBox2.Checked = True Then

            Label3.Visible = True
            NumericUpDown1.Visible = True
            Timer1.Enabled = True
        End If
        If CheckBox2.Checked = False Then
            Label3.Visible = False
            NumericUpDown1.Visible = False
            Timer1.Enabled = False
        End If

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If CheckBox1.Checked = True Then
            Timer2.Enabled = True
            message.From = New MailAddress("TuCorreoElectronico")
            message.To.Add(TextBox1.Text)
            message.Body = "Su dirección IP es: " + Label1.Text
            message.Subject = "IP"
            smtp.EnableSsl = True
            smtp.Port = "587"
            smtp.Host = "smtp.live.com"
            smtp.Credentials = New Net.NetworkCredential("TuCorreoElectronico", "ContraseñaDeTuCorreoElectronico")
            smtp.Send(message)
        End If

        If CheckBox2.Checked = True Then
            Dim time2 As New Double
            time2 = NumericUpDown1.Value * 1000
            Timer1.Interval = time2
            Timer1.Enabled = True
        End If
    End Sub

    Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = False Then CheckBox2.Visible = False
        If CheckBox1.Checked = True Then CheckBox2.Visible = True
        If CheckBox1.Checked = False Then TextBox1.Visible = False
        If CheckBox1.Checked = True Then TextBox1.Visible = True
        If CheckBox1.Checked = False Then ProgressBar1.Visible = False
        If CheckBox1.Checked = True Then ProgressBar1.Visible = True
        If CheckBox1.Checked = False Then Me.Height = 117
        If CheckBox1.Checked = True Then Me.Height = 281
        If CheckBox1.Checked = True Then TextBox1.ReadOnly = False
        If CheckBox1.Checked = True Then TextBox1.Text = ""
        If CheckBox1.Checked = False Then TextBox1.ReadOnly = True
        If CheckBox1.Checked = False Then TextBox1.Text = "Bloqueado"
        If CheckBox1.Checked = True Then Button1.Visible = True
        If CheckBox1.Checked = False Then Button1.Visible = False
    End Sub

    Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked = True Then
            MsgBox("Al activar esta función no puede cerrar la aplicación")
            Label3.Visible = True
            NumericUpDown1.Visible = True
        End If
        If CheckBox2.Checked = False Then
            Label3.Visible = False
            NumericUpDown1.Visible = False
        End If
    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        ProgressBar1.Increment(6)
        If ProgressBar1.Value = 99 Then
            Timer2.Enabled = False
            MsgBox("Correo enviado")
            ProgressBar1.Value = 0
        End If

    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.