Está en la página 1de 2

Universidad tecnolgica Nacional Facultad Regional Baha Blanca

Fundamentos de Informtica Lic. Lucrecia Lavirgen

Lenguaje de Programacin Visual Basic Ejemplo 1


Private Sub division_Click() Dim a As Integer Dim b As Integer a = nro1 b = nro2 If b <> 0 Then Resultado = a / b Else MsgBox ("No se puede dividir por 0") End If End Sub Private Sub Fin_Click() End End Sub Private Sub multiplicacion_Click() Dim a As Integer Dim b As Integer a = nro1 b = nro2 Resultado = a * b End Sub Private Sub resta_Click() Dim a As Integer Dim b As Integer a = nro1 b = nro2 Resultado = a - b End Sub Private Sub suma_Click() Dim a As Integer Dim b As Integer a = nro1 b = nro2 Resultado = a + b End Sub

Ejemplo 2
Private Sub Command1_Click() superficie = base * base End Sub Private Sub Command2_Click() End End Sub

Universidad tecnolgica Nacional Facultad Regional Baha Blanca Private Sub Option_azul_Click() Shape1.BackColor = vbBlue End Sub Private Sub Option_rojo_Click() Shape1.BackColor = vbRed End Sub Private Sub Option_verde_Click() Shape1.BackColor = vbGreen End Sub

Fundamentos de Informtica Lic. Lucrecia Lavirgen

Ejemplo 3 Private Sub Fin_Click() End End Sub Private Sub mayor_Click() Dim va, vb As Integer va = nro1.Text vb = nro2.Text If va > vb Then MsgBox ("El mayor es ") + nro1.Text Else MsgBox ("El mayor es ") + nro2.Text End If End Sub

También podría gustarte