PROGRAMACIÓN VISUAL BASIC PROGRAMAS BÁSICOS PARA APRENDER A PROGRAMAR Aquí encontraras pistas y claves que te ayudaran a programar en el futuro conoce comandos fáciles y sencillos para que la programación se vuelva una herramienta eficaz en tu trabajo tus reuniones hasta en tu casa descubrirás que la programación no es tan difícil
Índice
1. Introducción 2. Herramientas 2.1
Herramientas a usar
2.1.1 TextBox 2.1.2 Lavel 2.1.3 Button 3. Programas 3.1 4 operaciones 3.2 calculadora 3.3 horas minutos y segundos 3.4 días horas minutos y segundos 3.5 dólares a euros 3.6 convertidor de monedas 3.7 área del triangulo 3.8 área y perímetro del triangulo 3.9 área y perímetro del cuadrado 3.10 área y perímetro del rombo 3.11 área y perímetro del rectángulo 3.12 área y perímetro del circulo 3.13 escala de notas 3.14 positivo negativo 3.15 par impar 3.16 tablas de multiplicar 3.17 figuras geométricas 3.18 factura 4. Zona de Juegos
1. Introducción Microsoft Visual Studio Microsoft Visual Studio es un entorno de desarrollo integrado (IDE, por sus siglas en inglés) para sistemas operativos Windows. Soporta varios lenguajes de programación tales como Visual C++, Visual C#, Visual J#, y Visual Basic .NET, al igual que entornos de desarrollo web como ASP.NET. aunque actualmente se han desarrollado
2. Herramientas La barra de herramientas estándar de Visual Basic es otro componente de Visual Basic es donde tienen agrupaos los botones utilizados con frecuencia La barra de herramientas no estándar dentro de visual Basic es donde se agrupan la gran mayoría de objetos y controles que se incluirán en nuestro proyecto.
las extensiones necesarias para muchos otros. Visual Studio permite a los desarrolladores crear aplicaciones, sitios y aplicaciones web, así como servicios web en cualquier entorno que soporte la plataforma .NET (a partir de la versión .NET 2002). Así se pueden crear aplicaciones que se intercomuniquen entre estaciones de trabajo, páginas web y dispositivos móviles.
2.1
Herramientas a usar
2.1.1
TextBox
El control TextBox o Caja de texto se utiliza para Ingresar y/o visualizar
sueldo, etc.), en cierta forma hace las funciones de printf, cout, writeln, print, display, etc., pero solo cuando se consideran en su parte de mensajes.
Texto (es un control de entrada de datos)
2.1.3 Button
La propiedad principal de este control
Este control " Botón de comando ", nos
se llama Text. Mediante ella podemos
permite ejecutar alguna rutina, función
asignarle un texto ya sea en tiempo de
o procedimiento, generalmente en el
diseño o tiempo de ejecución al control.
evento click del mismo, para realizar de
2.1.2
Label
Este componente se utiliza para desplegar textos o mensajes estáticos dentro de las formas, textos tales como encabezados, solicitud al usuario del programa para que proporcione algún dato o información(edad, dame
esta manera alguna tarea dentro del programa Como se dijo, se utiliza generalmente en el evento Click par ejecutar alguna acción cuando se produce dicho evento, y es precisamente el evento Click, el que por defecto añade Visual Basic al control
3. Programas Los programas que vamos a realizar son muy fáciles y sencillos solo utilizaremos las 3 herramientas anterior mente comentadas Lo primero que siempre aremos es darle la forma al programa comenzaremos diseñando la forma de nuestro programa a conveniencia 3.1
Programa las 4 operaciones básicas Lavel
Lo primero será crear el formato En este he usado las 3 herramientas De las que hemos estado hablando Ahora vamos al código Lo que tenemos que hacer es Configurar los Buttons Y declarar variadles dependiendo del Programa Se ara eso usando el siguiente código
Button
Damos doble clik en el button “suma” TextBox3.Text = Val(TextBox2.Text) + Val(TextBox1.Text)
El button ”resta” TextBox3.Text = Val(TextBox2.Text) - Val(TextBox1.Text)
El button “multiplication” TextBox3.Text = Val(TextBox2.Text) Val(TextBox1.Text)
El button “divicion”
TextBox3.Text = Val(TextBox2.Text) / Val(TextBox1.Text) Y el codigo final queda Public Class Form1 Dim Text3 As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox3.Text = Val(TextBox2.Text) + Val(TextBox1.Text) End Sub Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox3.Text = Val(TextBox2.Text) - Val(TextBox1.Text) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox3.Text = Val(TextBox2.Text) * Val(TextBox1.Text) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox3.Text = Val(TextBox2.Text) / Val(TextBox1.Text) End Sub End Class
3.2
Calculadora
Diseñaremos el programa
Después de a ver diseñado la calculadora vamos a programar Comenzaremos con los números Damos doble clik en el button 0 Y escribiremos lo siguiente TextBox1.Text = TextBox1.Text & "0"
Aremos eso con todos lo numero Ahora vamos a los buttons de suma, resta, multiplicación y división En el button suma escribimos
OPE = 1 DATO = Val(TextBox1.Text) TextBox1.Clear() BT2.Enabled = True
En el button resta OPE = 2 DATO = Val(TextBox1.Text) TextBox1.Clear() BT2.Enabled = True
En el button multiplication OPE = 3 DATO = Val(TextBox1.Text) TextBox1.Clear() BT2.Enabled = True
En el button division OPE = 4 DATO = Val(TextBox1.Text) TextBox1.Clear() BT2.Enabled = True
Después el button del igual DATO2 = Val(TextBox1.Text) If OPE = 1 Then RESUL = DATO + DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 2 Then RESUL = DATO - DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 3 Then RESUL = DATO * DATO2 TextBox1.Text = RESUL BT2.Enabled = True Else If OPE = 4 Then RESUL = DATO / DATO2 TextBox1.Text = RESUL BT2.Enabled = True End If End If End If End If
Después el button de borrar
TextBox1.clear () Al inicio del programa declararemos las siguientes variables Dim Dim Dim Dim Dim
DATO As Double DATO2 As Double RESUL As Double OPE As Double PUN As Double
3.3 Horas a minutos y segundos Los siguientes programas son variaciones de los c贸digos que ya hemos visto
El c贸digo Private Sub cal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cal.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 60 TextBox3.Text = COMBER * 3600 End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub Private Sub l1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles l1.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged COMBER = Val(TextBox1.Text) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.4
D铆as horas minutos y segundos
C贸digo Public Class Form1 Dim COMBER As Double
Private Sub cal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cal.Click COMBER = Val(TextBox4.Text) TextBox1.Text = COMBER * 24 TextBox2.Text = COMBER * 1440 TextBox3.Text = COMBER * 86400 End Sub
Private Sub l1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles l1.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear()
TextBox4.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click End Sub End Class
3.5
D贸lares a Euros
C贸digo Public Class Form1 Dim COMBER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 0.772778
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End
End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.6
convertidor de monedas
C贸digo Public Class Form1 Dim COMBER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click COMBER = Val(TextBox1.Text) TextBox2.Text = COMBER * 0.772778 TextBox3.Text = COMBER * 12.4659 TextBox4.Text = COMBER * 95.8985 TextBox5.Text = COMBER * 1.50201 TextBox6.Text = COMBER * 10.5674 TextBox7.Text = COMBER * 6.95974
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub End Class
3.7
área del triangulo
Public Class Form1 Dim BAS As Double Dim ALT As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) TextBox3.Text = (BAS * ALT) / 2
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.8
área y perímetro del triangulo
Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) TextBox3.Text = (BAS * ALT) / 2 TextBox7.Text = per1 + per2 + per3
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.9
área y perímetro del cuadrado
Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.10 área y perímetro del rombo
Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.11 área y perímetro del rectángulo
Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = Val(TextBox2.Text) per1 = Val(TextBox4.Text) per2 = Val(TextBox5.Text) per3 = Val(TextBox6.Text) per4 = Val(TextBox8.Text) TextBox3.Text = (BAS * ALT) TextBox7.Text = per1 + per2 + per3 + per4
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.12 área y perímetro del circulo
Public Class Form1 Dim BAS As Double Dim ALT As Double Dim per1 As Double Dim per2 As Double Dim per3 As Double Dim per4 As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BAS = Val(TextBox1.Text) ALT = 3.14159 * 2 TextBox3.Text = (BAS) * (ALT) TextBox7.Text = 2 * ALT * BAS
End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Clear() TextBox3.Clear()
TextBox7.Clear()
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.12 escala de notas
Public Class Form1 Dim n1 As Double Dim n2 As Double Dim n3 As Double Dim n4 As Double Dim resul As Double Dim pro As Double Dim div As Double Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged n1 = Val(TextBox1.Text) If n1 > 10 Then MsgBox("error nota mayor a 10") End If End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged n2 = Val(TextBox2.Text) If n2 > 10 Then MsgBox("error nota mayor a 10") End If
End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged n3 = Val(TextBox3.Text) If n3 > 10 Then MsgBox("error nota mayor a 10") End If End Sub Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged n4 = Val(TextBox4.Text) If n4 > 10 Then MsgBox("error nota mayor a 10") End If End Sub Private Sub BT5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT5.Click TextBox5.Text = TextBox5.Text TextBox5.Text = (n1 + n2 + n3 + n4) End Sub Private Sub BT6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT6.Click div = 4 TextBox6.Text = (n1 + n2 + n3 + n4) / div resul = (n1 + n2 + n3 + n4) / div End Sub Private Sub BT7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT7.Click If resul = 10 Then TextBox7.Text = " supera los aprendizajes requeridos" Else If resul >= 8 Then TextBox7.Text = "domina los aprendizajes requeridos " Else If resul = 7 Then TextBox7.Text = "alcansa los aprendizajes requeridos " Else If resul >= 5 Then TextBox7.Text = "proximo los aprendizajes requeridos " Else If resul <= 4 Then TextBox7.Text = "no alcansa los aprendizajes requeridos " End If End If End If End If End If End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
End Sub Private Sub BT2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BT3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BT4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged End Sub Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged End Sub Private Sub BT1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class
3.13 positivo negativo
Public Class Form1 Dim NUM As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
NUM = Val(TextBox1.Text) If NUM <= 0 Then TextBox2.Text = "NEGATIVO"
Else TextBox2.Text = "POSITIVO" End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
3.14 par impar
Public Class Form1 Dim NUM As Double Dim OPER As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click NUM = Val(TextBox1.Text) OPER = NUM Mod 2 If OPER = 1 Then TextBox2.Text = "IMPAR"
Else TextBox2.Text = "PAR" End If End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() End Sub
3.15 tablas de multiplicar
Programa 16 Public Class Form1 Dim TB As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TB = Val(TextBox37.Text) TextBox13.Text = TB TextBox14.Text = TB TextBox15.Text = TB TextBox16.Text = TB TextBox17.Text = TB TextBox18.Text = TB TextBox19.Text = TB TextBox20.Text = TB TextBox21.Text = TB TextBox22.Text = TB TextBox23.Text = TB TextBox24.Text = TB TextBox25.Text TextBox26.Text TextBox27.Text TextBox28.Text TextBox29.Text TextBox30.Text TextBox31.Text
= = = = = = =
TB TB TB TB TB TB TB
* * * * * * *
TextBox1.Text TextBox2.Text TextBox3.Text TextBox4.Text TextBox5.Text TextBox6.Text TextBox7.Text
TextBox32.Text TextBox33.Text TextBox34.Text TextBox35.Text TextBox36.Text
= = = = =
TB TB TB TB TB
* * * * *
TextBox8.Text TextBox9.Text TextBox10.Text TextBox11.Text TextBox12.Text
End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox13.Clear() TextBox14.Clear() TextBox15.Clear() TextBox16.Clear() TextBox17.Clear() TextBox18.Clear() TextBox19.Clear() TextBox20.Clear() TextBox21.Clear() TextBox22.Clear() TextBox23.Clear() TextBox24.Clear() TextBox25.Clear() TextBox26.Clear() TextBox27.Clear() TextBox28.Clear() TextBox29.Clear() TextBox30.Clear() TextBox31.Clear() TextBox32.Clear() TextBox33.Clear() TextBox34.Clear() TextBox35.Clear() TextBox37.Clear() TextBox36.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
3.16 figuras geométricas
Public Class Form1 Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim
a As Double h As Double base As Double rd As Double pi As Double Bs As Double H2 As Double l1 As Double l2 As Double l3 As Double cb As Double ld As Double ld2 As Double ld3 As Double rd2 As Double h3 As Double hp As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click a = Val(TextBox1.Text) TextBox2.Text = a * a TextBox3.Text = a + a + a + a End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click h = Val(TextBox5.Text) base = Val(TextBox4.Text) TextBox6.Text = base * h TextBox7.Text = (2 * base) + (2 * h) End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click rd = TextBox8.Text pi = 3.1415 TextBox9.Text = pi * (rd * rd) TextBox10.Text = 2 * rd * pi End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Bs = Val(TextBox11.Text) H2 = Val(TextBox12.Text) l1 = TextBox13.Text l2 = TextBox14.Text hp = Math.Sqrt(l1 ^ 2 + l2 ^ 2) TextBox15.Text = (Bs * H2) / 2 TextBox16.Text = l1 + l2 + hp End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click cb = Val(TextBox17.Text) TextBox18.Text = 6 * (cb ^ 2) TextBox19.Text = cb ^ 3 End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click ld = Val(TextBox20.Text) ld2 = Val(TextBox21.Text) ld3 = Val(TextBox22.Text) TextBox23.Text = 2 * (ld * ld2) + 2 * (ld2 * ld3) + 2 * (ld * ld3) TextBox24.Text = ld * ld2 * ld3 End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click h3 = TextBox30.Text rd2 = TextBox25.Text pi = 3.1415 TextBox27.Text = 2 * pi * (rd2 * rd2) TextBox28.Text = 2 * pi * rd2 * h3 TextBox26.Text = 2 * rd2 * pi TextBox29.Text = pi * (rd2 * rd2) * h3 End Sub End Class
3.18 factura
Public Class Form1 Dim C1 As Double Dim C2 As Double Dim C3 As Double Dim C4 As Double Dim C5 As Double Dim C01 As Double Dim C02 As Double Dim C03 As Double Dim C04 As Double Dim C05 As Double Dim CAN As Double Dim CAN2 As Double Dim CAN3 As Double
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click End Sub Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click C1 = Val(TextBox1.Text) C2 = Val(TextBox2.Text) C3 = Val(TextBox3.Text) C4 = Val(TextBox4.Text) C5 = Val(TextBox5.Text) C01 = Val(TextBox15.Text) C02 = Val(TextBox14.Text) C03 = Val(TextBox13.Text) C04 = Val(TextBox12.Text) C05 = Val(TextBox11.Text) TextBox20.Text = C1 * C01 TextBox19.Text = C2 * C02 TextBox18.Text = C3 * C03 TextBox17.Text = C4 * C04 TextBox16.Text = C5 * C05 CAN = C5 * C05 + C4 * C04 + C3 * C03 + C2 * C02 + C1 * C01 CAN2 = C5 * C05 + C4 * C04 + C3 * C03 + C2 * C02 + C1 * C01 TextBox25.Text = CAN If CAN >= 10000 Then MsgBox("DESCUENTO DE 25%") TextBox24.Text = CAN * 0.25 CAN2 = CAN * 0.25 Else If CAN >= 5000 Then MsgBox("DESCUENTO DE 20%") TextBox24.Text = CAN * 0.2 CAN2 = CAN * 0.2 Else If CAN >= 2500 Then MsgBox("DESCUENTO DE 15%") TextBox24.Text = CAN * 0.15 CAN2 = CAN * 0.15 Else If CAN >= 1200 Then MsgBox("DESCUENTO DE 10%") TextBox24.Text = CAN * 0.1 CAN2 = CAN * 0.1 Else If CAN >= 350 Then MsgBox("DESCUENTO DE 5%") TextBox24.Text = CAN * 0.05 CAN2 = CAN * 0.05 Else If CAN < 350 Then MsgBox("SIN DESCUENTO") CAN2 = 0 End If End If End If End If End If End If TextBox23.Text = CAN - CAN2
TextBox22.Text = CAN * 0.12 CAN3 = CAN * 0.12 TextBox21.Text = CAN - CAN2 + CAN3
End Sub Private Sub TextBox24_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox24.TextChanged End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() TextBox8.Clear() TextBox9.Clear() TextBox10.Clear() TextBox11.Clear() TextBox12.Clear() TextBox13.Clear() TextBox14.Clear() TextBox15.Clear() TextBox16.Clear() TextBox17.Clear() TextBox18.Clear() TextBox19.Clear() TextBox20.Clear() TextBox21.Clear() TextBox22.Clear() TextBox23.Clear() TextBox24.Clear() TextBox25.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub End Class
4. Zona de Juegos no leas los colores dilos
Se aleja o se encoje
Termina el laberinto
Cuantos puntos hay