problemas resueltos en vb

4
pregunta 3 Private Sub cmdcalcular_click() Dim x As Integer x = Val(txtnumero.Text) a = 3.1416 * (x ^ 2) b = (x ^ 2) * 6 If x > 0 Then If x Mod 2 = 0 Then lbligual.Caption = "el Numero " & x & " es numero par" & " y el area del circulo es : " & a Else lbligual.Caption = "El numero " & x & " es numero impar" & " y el area del cuadrado es : " & b End If End If If x = o Then r = MsgBox("ingrese otro numero diferente de cero", vbCritical, "aviso...") txtnumero = "" lbligual.Caption = "" txtnumero.SetFocus End If End Sub Private Sub Cmdlimpiar_Click() txtnumero.Text = "" txtnumero.SetFocus lbligual = ""

Upload: jhon-suarez

Post on 12-Dec-2015

232 views

Category:

Documents


0 download

DESCRIPTION

ejercicios resueltos en vb

TRANSCRIPT

Page 1: problemas resueltos en vb

pregunta 3

Private Sub cmdcalcular_click()

Dim x As Integer x = Val(txtnumero.Text) a = 3.1416 * (x ^ 2) b = (x ^ 2) * 6 If x > 0 Then If x Mod 2 = 0 Then lbligual.Caption = "el Numero " & x & " es numero par" & " y el area del circulo es : " & a Else lbligual.Caption = "El numero " & x & " es numero impar" & " y el area del cuadrado es : " & b End If End If If x = o Then r = MsgBox("ingrese otro numero diferente de cero", vbCritical, "aviso...") txtnumero = "" lbligual.Caption = "" txtnumero.SetFocus End If End SubPrivate Sub Cmdlimpiar_Click()txtnumero.Text = ""txtnumero.SetFocuslbligual = ""End Sub Private Sub cmdsalir_Click() r = MsgBox("¿Desea salir del programa?", vbYesNo + vbQuestion, "aviso...") If r = vbYes Then End

End Sub

Page 2: problemas resueltos en vb

Pregunta 2

Private Sub Command1_Click()Dim a, b, c As Integera = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)

x = (sqrt((a * (b ^ 2) + 4 * (c * b)) / sqrt(((a * 4 / 2 * b) ^ 2) + c + (sqrt(3 * a * b) / c)))) Label2.Caption = " la respuesta de la ecuacion es " & x End Sub

Private Sub Command2_Click() MsgBox "¿Desea salir?", vbQuestion, "AVISO DE SISTEMA" EndEnd Sub

Private Sub Command3_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Label2.Caption = ""Text1.SetFocus

End Sub

Page 3: problemas resueltos en vb

Private Sub Command1_Click()Dim a, b, c, d As Integera = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)If a < b And b < c ThenLabel2.Caption = " el orden de nemor a mayor es " & a & ", " & b & ", " & cEnd IfIf b < c And c < a ThenLabel2.Caption = " el orden de nemor a mayor es " & b & ", " & c & ", " & aEnd IfIf c < b And b < a ThenLabel2.Caption = " el orden de nemor a mayor es " & c & ", " & b & ", " & aEnd IfIf a < c And c < b ThenLabel2.Caption = " el orden de nemor a mayor es " & a & ", " & c & ", " & bEnd If End SubPrivate Sub Command2_Click() MsgBox "¿Desea salir?", vbQuestion, "AVISO DE SISTEMA" EndEnd SubPrivate Sub Command3_Click()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Label2.Caption = ""Text1.SetFocus

End Sub

Page 4: problemas resueltos en vb