Laura Natalia Snchez Torres Laura Melissa Saavedra Pinilla
INSTITUCION EDUCATIVA ANTONIO NARIO SEDE TEACADEMICO LOGICA Y PROGRAMACION 10-01 TECNICO MONIQUIRA 2011
EJEMPLOS DE VISUAL BASIC
Erika Juliana Rodrguez Snchez Laura Natalia Snchez Torres Laura Melissa Saavedra Pinilla
INSTITUCION EDUCATIVA ANTONIO NARIO SEDE TECNICO ACADEMICO LOGICA Y PROGRAMACION 10-01 TECNICO MONIQUIRA 2011
Xovtcvioo 1EJEMPLO DE COLORES ................................................................................................................................. 4 2.EJEMPLO DE SUMAS.5 a 6 3.EJEMPLO DE TEMPERATURA.7 a 8
4
1. EJEMPLO DE COLORES
Ec toto oc cci c _oo o tooi_iv uuc oc uuico oo o uv o|cto.
Private Sub Form_Load()
End Sub Private Sub Option1_Click()
Text1.BackColor = vbBlue End Sub Private Sub Option2_Click()
Text1.BackColor = vbRed End Sub Private Sub Option3_Click()
Text1.BackColor = vbGreen End Sub Private Sub Option4_Click()
Text1.BackColor = vbYellow End Sub Private Sub Option5_Click()4 Text1.Top = End Sub
Private Sub Option6_Click() Text1.Top = From1.ScaleHeight - Text1.Height End Sub
5
2. EJEMPLO DE SUMAS
Esta aplicacin nos permite realizar en forma rpida y sencilla la suma de grandes y varias cantidades y lograr Su resultado .
Private Sub Command1_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" End Sub Private Sub Command2_Click() Dim suma As Integer suma = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) Text4.Text = suma End Sub Private Sub Command3_Click() End
6
End Sub Private Sub Form_Load()
End Sub Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then If Text1.Text = "" ThenMsgBox ("digite un numero") Text1.SetFocus
Else Text2.SetFocus
End If End If End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text2.Text = "" ThenMsgBox ("digite un numero") Text2.SetFocus ElseText3.SetFocus
End If End If End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Text3.Text = "" ThenMsgBox ("digite un numero") Text3.SetFocus
Else Text4.Text = suma
End If End If End Sub
7
3. EJEMPLO DE TEMPERATURA Esta aplicacin nos ayuda a averiguar cual el la temperatura en grados centgrados y grados Fahrenheit De Cualquier cosa u objeto o ciudad .
End End Sub
Private Sub Text3_Change()
End Sub
Private Sub mnuFile_Click() End End Sub
Private Sub cmdSalir_Click() 8
Beep End
End Sub
Private Sub VScroll1_Change() TextCent.Text = VScroll1.Value TextFahr.Text = 32 + 1.8 * VScroll1.Value End Sub
9
4. EJEMPLO NOTAS
Esta aplicacin nos muestra como podemos sacar las notas y llegar a su resultado.
Private Sub Command1_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" End Sub Private Sub Command2_Click() Dim suma As Double suma = (((Val(Text1.Text) * 0.5)) + ((Val(Text2.Text) * 0.2)) +((Val(Text3.Text) * 0.15)) + ((Val(Text4.Text) * 0.15))) Text5.Text = suma End Sub Private Sub Command3_Click() End 10