jueves, 24 de septiembre de 2015

The object 'x' does not exist or is invalid for this operation

Edit-->IntelliSense-->Refresh Local Cache


viernes, 11 de septiembre de 2015

Invertir un número

Module Module1
    Sub Main()
        Dim numero As Long = 987654321
        Dim numero_invertido As Integer = 0
        While numero > 0
            numero_invertido = (numero_invertido * 10) + (numero Mod 10)
            numero = Math.Truncate(numero / 10)
        End While
        Console.WriteLine(numero_invertido)
        Console.ReadKey()
    End Sub
End Module


Mostrar icono de información y error en MessageBox

MessageBox.Show("Mensaje","Título ventana", MessageBoxButtons.OK, MessageBoxIcon.Error)
MessageBox.Show("Mensaje","Título ventana", MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show("No se pudo establecer conexión con el servidor", "", _
                            MessageBoxButtons.OK, MessageBoxIcon.Warning)


lunes, 7 de septiembre de 2015

Validar Rut Chile

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim dv As String = Nothing
        Dim suma As Integer = 0
        Dim iRut() As Char = StrReverse(TextBox1.Text.Trim)
        Dim j As Integer = 1

        For i As Integer = 0 To iRut.Length - 1
            j += 1
            suma = suma + (Val(iRut(i)) * j)
            If j = 7 Then
                j = 1
            End If
        Next
        dv = digitoVerificador(suma)
        If dv = TextBox2.Text.ToUpper Then
            MessageBox.Show("RUT CORRECTO!")
        Else
            MessageBox.Show("RUT INCORRECTO!")
        End If
    End Sub

    Public Function digitoVerificador(ByVal d_v As Integer) As String
        d_v = 11 - (d_v Mod 11)
        If d_v = 10 Then
            Return "K"
        ElseIf d_v = 11 Then
            Return "0"
        Else
            Return d_v
        End If
    End Function



Descarga: http://bit.ly/1K0nTLs