lunes, 26 de noviembre de 2012


CODIGO CALCULADORA SIMPLE

Public Class Form2
    Dim guarda As Integer = 0
    Dim signo As String

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        operador("/")
    End Sub
    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        operador("*")
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        operador("-")
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        operador("+")

    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    Sub calcular(ByVal valor)
        If Txtpantalla.Text = "+" Or Txtpantalla.Text = "-" Or Txtpantalla.Text = "*" Or Txtpantalla.Text = "/" Then
            Txtpantalla.Text = ""
            Txtpantalla.Text = Txtpantalla.Text + CStr(valor)
        Else

            Txtpantalla.Text = Txtpantalla.Text + CStr(valor)
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        calcular(1)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        calcular(2)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        calcular(3)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        calcular(4)
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        calcular(5)
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        calcular(6)
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        calcular(7)
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        calcular(8)
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        calcular(9)

    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        calcular(0)

    End Sub
    Sub operador(ByVal oper)
        signo = oper
        guarda = CInt(Txtpantalla.Text)
        Txtpantalla.Text = signo

    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Select Case signo
            Case "+"
                Txtpantalla.Text = CStr(guarda + CInt(Mid(Txtpantalla.Text, 1)))
            Case "-"
                Txtpantalla.Text = CStr(guarda - CInt(Txtpantalla.Text))
            Case "*"
                Txtpantalla.Text = CStr(guarda * CInt(Txtpantalla.Text))
            Case "/"
                Txtpantalla.Text = CStr(guarda / CInt(Txtpantalla.Text))
        End Select
    End Sub
End Class

jueves, 25 de octubre de 2012

Blog con recursos para proyectos:
http://proyectosvb2008.blogspot.com

codigo para Web browser:
 Private Sub AxWindowsMediaPlayer1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "Google Busqueda" Then
            WebBrowser1.Navigate("http://www.google.com/search?hl=en&q=" + TextBox1.Text + "&btnG=Google+Search&meta=&aq=f&oq=")
        ElseIf ComboBox1.Text = "Google Imagenes" Then

            WebBrowser1.Navigate("http://images.google.com/images?hl=en&q=" + TextBox1.Text + "&btnG=Search+Images&gbv=2&aq=f&oq=")
        Else
            WebBrowser1.Navigate("http://maps.google.com/maps?hl=en&q=" + TextBox1.Text + "&btnG=Search+Maps&gbv=2&aq=f&oq=")
        End If
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        WebBrowser1.Navigate(TextBox1.Text)
    End Sub
End Class

jueves, 15 de marzo de 2012

BIFURCACIONES

EJERCICIO 2


Código:
Public Class Form1
    Dim genero As String
    Dim edad As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        genero = UCase(ComboBox1.Text)
        edad = Val(TextBox2.Text)
        PictureBox1.Visible = True

        If genero = "MASCULINO" And edad <= 12 Then
            Label4.Text = "Niño"
            Me.PictureBox1.Image = My.Resources.niño
            Me.BackColor = Color.SlateBlue

        ElseIf genero = "MASCULINO" And edad < 18 Then
            Label4.Text = "Adolscente Varon"
            Me.PictureBox1.Image = My.Resources.adolh
            Me.BackColor = Color.Silver
        ElseIf genero = "MASCULINO" And edad <= 50 Then
            Label4.Text = "Adulto"
            Me.PictureBox1.Image = My.Resources.adulto
            Me.BackColor = Color.SkyBlue

        ElseIf genero = "MASCULINO" And edad > 50 Then
            Label4.Text = "Adulto Mayor"
            Me.PictureBox1.Image = My.Resources.adultomayor
            Me.BackColor = Color.SlateGray
        ElseIf genero = "FEMENINO" And edad <= 12 Then

            Label4.Text = "Niña"
            Me.PictureBox1.Image = My.Resources.niña
            Me.BackColor = Color.Pink
        ElseIf genero = "FEMENINO" And edad < 18 Then
            Label4.Text = "Adolscente Mujer"
            Me.PictureBox1.Image = My.Resources.adolm
            Me.BackColor = Color.PeachPuff
        ElseIf genero = "FEMENINO" And edad <= 50 Then
            Label4.Text = "Adulta Mujer"
            Me.PictureBox1.Image = My.Resources.adulta
            Me.BackColor = Color.PaleTurquoise
        ElseIf genero = "FEMENINO" And edad > 50 Then
            Label4.Text = "Adulta Mayor"
            Me.PictureBox1.Image = My.Resources.adultamayor
            Me.BackColor = Color.Olive



        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.Visible = False

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()

    End Sub
End Class