jueves, 3 de mayo de 2012

RETO5 – Funciones de Cadena




Imports vb = Microsoft.VisualBasic
Public Class FuncionesCadena

    Private Sub btnmostrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmostrar.Click
        Dim frase As String = txtfrase.Text
        txtlongitud.Text = Len(frase)
        txtprimerc.Text = Microsoft.VisualBasic.Left(Trim(frase), 1)
        txtultimoc.Text = Microsoft.VisualBasic.Right(Trim(frase), 1)
        txtsegysexto.Text = Mid(frase, 2, 6)
        txta.Text = InStr((UCase(frase)), "A")
        txtmayuscula.Text = UCase(frase)
        txtminuscula.Text = LCase(frase)
        txtprimmayuscula.Text = UCase(Microsoft.VisualBasic.Left(Trim(frase), 1))
    End Sub

    Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
        Dim ctl As Object
        For Each ctl In Me.Controls
            If TypeOf ctl Is TextBox Then
                ctl.Text = ""
            End If
        Next
        txtfrase.Focus()
    End Sub
    Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        Dim salida As Integer = MsgBox("Desea Salir?",
        MsgBoxStyle.YesNo + 32, "Mensaje al usuario")
        If salida = 6 Then
            Me.Close()
        End If
    End Sub
End Class

No hay comentarios:

Publicar un comentario