InicioInfoComandos de Visual Basic

Comandos de Visual Basic

Info6/4/2009
Hola!!
Estos son los codigos de los ejercicios mas comunes y faciles de Visual Basic 6.0

EJERCICIO DE LA CALCULADORA


El botón Nuevo Cálculo
Private Sub Command5_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub

El botón Sumar
Private Sub Command1_Click()
Text3 = Val(Text1) + Val(Text2)
End Sub

El botón Restar
Private Sub Command2_Click()
Text3 = Val(Text1) - Val(Text2)
End Sub

El botón Multiplicar
Private Sub Command3_Click()
Text3 = Val(Text1) * Val(Text2)
End Sub

El botón Dividir
Private Sub Command4_Click()
Text3 = Val(Text1) / Val(Text2)
End Sub

El botón Salir
Private Sub Command6_Click()
Unload Me
End
End Sub

EJERCICIO CALCULADORA 2


El botón Calcular
Private Sub Command1_Click()
If Option1 = True Then
Text3 = Val(Text1) / Val(Text2)
ElseIf Option2 = True Then
Text3 = Val(Text1) * Val(Text2)
ElseIf Option3 = True Then
Text3 = Val(Text1) - Val(Text2)
ElseIf Option4 = True Then
Text3 = Val(Text1) + Val(Text2)
End If
End Sub

El botón Otra Operación
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
End Sub

EJERCICIO CONVERSIONES


El botón Convertir
Private Sub Command1_Click()
If Option1 = True Then
Text2 = Val(Text1) * 1000
ElseIf Option2 = True Then
Text2 = Val(Text1) * 100
ElseIf Option3 = True Then
Text2 = Val(Text1) * 10
ElseIf Option4 = True Then
Text2 = Val(Text1) / 1000
End If
End Sub

EJERCICIO TABLAS


El botón Ver Tabla
Private Sub Command1_Click()
Dim res As Long, retorno
For n = 1 To 10
res = Text1 * n
retorno = Chr(13) & Chr(10)
Text2 = Text2 & Text1 & " x " & n & " = " & res & retorno
Next n
End Sub

El botón Salir

If MsgBox("Por Favor Confirma Si Ya Te Quieres Ir", vbYesNo, "¿Qué Ya Te Quieres Ir?" = vbYes Then
End
Else
Cancel = 1
End If

EJERCICIO TERMOMETRO


Boton salir

Private Sub cmbSalir_Click()
Beep
End
End Sub


Private Sub mnuFileExit_Click()
End
End Sub

Barra

Private Sub vsbTemp_Change()
txtCent.Text = vsbTemp.Value
txtFahr.Text = 32 + 1.8 * vsbTemp.Value
End Sub

Bueno espero q les sirvan tanto como en algun momento me sirvio a mi



link de mas posts :


Datos archivados del Taringa! original
0puntos
10,287visitas
0comentarios
Actividad nueva en Posteamelo
0puntos
2visitas
0comentarios
Dar puntos:

Posts Relacionados

Anónimo
0
archivado

Dejá tu comentario

0/2000

No hay comentarios nuevos todavía

Autor del Post

m
moburao🇦🇷
Usuario
Puntos0
Posts5
Ver perfil →
PosteameloArchivo Histórico de Taringa! (2004-2017). Preservando la inteligencia colectiva de la internet hispanohablante.

CONTACTO

18 de Septiembre 455, Casilla 52

Chillán, Región de Ñuble, Chile

Solo correo postal

© 2026 Posteamelo.com. No afiliado con Taringa! ni sus sucesores.

Contenido preservado con fines históricos y culturales.