ECUACIÓN DE PRIMER GRADO EN VISUAL BASIC 6.0
ECUACIÓN DE PRIMER GRADO EN VISUAL BASIC 6.0
Aplicación que resuelve una ecuación de primer grado:Código completo:
Dim a, b, num As Double
----------------------------------------------
Private Sub cmdborrar_Click()
txta.Text = ""
txtnum.Text = ""
txtb.Text = ""
lblr1.Caption = ""
lblr2.Caption = ""
txta.SetFocus
End Sub
----------------------------------------------
Private Sub cmdnegativo_Click()
If (txta.Text = "") Or (txtb.Text = "") Or (txtnum.Text = "") Then
MsgBox "Sin datos no hay cálculos", vbCritical, "Prohibido"
txta.Text = 0
txtb.Text = 0
txtnum.Text = 0
End If
If (txta.Text = 0) Or (txtb.Text = 0) Or (txtnum.Text = 0) Then
MsgBox "Por favor ingrese un valor diferente de cero", vbCritical, "Prohibido"
End If
a = txta.Text
b = txtb.Text
num = txtnum.Text
txta.Text = ""
txtb.Text = ""
txtnum.Text = ""
txta.SetFocus
If (a > 0) Then
res = (b + num) / a
lblr2.Caption = "X es igual a: " & res
End If
End Sub
----------------------------------------------
Private Sub cmdpositivo_Click()
If (txta.Text = "") Or (txtb.Text = "") Or (txtnum.Text = "") Then
MsgBox "Ingrese un valor", vbCritical, "Prohibido"
txta.Text = 0
txtb.Text = 0
txtnum.Text = 0
End If
If (txta.Text = 0) Or (txtb.Text = 0) Or (txtnum.Text = 0) Then
MsgBox "Ingrese un valor diferente de cero", vbCritical, "Prohibido"
End If
a = txta.Text
b = txtb.Text
num = txtnum.Text
If (a > 0) Then
res = (b - num) / a
lblr1.Caption = "X es igual a: " & res
End If
End Sub
VÍDEO DE LA REALIZACIÓN DE LA APLICACIÓN
No hay comentarios.