You are on page 1of 2

Public Class Valores

Private dato1 As Single


Private dato2 As Single

Public Property valorDato1() As Single


Get
Return dato1
End Get
Set(ByVal value As Single)
dato1 = value
End Set
End Property

Public Property valorDato2() As Single


Get
Return dato2
End Get
Set(ByVal value As Single)
dato2 = value
End Set
End Property

Public Function sumar() As Single


Return (dato1 + dato2)
End Function

End Class

Public Class frmSumar


Dim objeto As New Valores()

Private Sub btnSumar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnSumar.Click
objeto.valorDato1 = CSng(txtDato1.Text)
objeto.valorDato2 = CSng(txtDato2.Text)
MessageBox.Show("El resultado de la suma es " & objeto.sumar())
End Sub

Private Sub btnBorrar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnBorrar.Click
txtDato1.Clear()
txtDato2.Clear()
End Sub

End Class

public Class Numeros

Private Sub btnborrar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles btnborrar.Click
txtDato.Text = " "
End Sub
Private Sub btnCalcular_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalcular.Click
Dim valorFinal As Integer
Dim resultado As Single = 0
valorFinal = txtDato.Text
For i = 1 To valorFinal Step 1
If i Mod 2 = 0 Then
resultado = resultado - (1 / i)
Else
resultado = resultado + (1 / i)
End If
Next
txtresultado.Text = resultado
End Sub
End Class

Select Case variable


Case valor1
�.
Case valor2
�.
Case valor3, valor4
�.
Case valor5 to valor 6
�.
Case Else
�.
End Select

If condici�n Then
�.
End If

If condici�n Then

Else

End If
If condicio�n Then

Else If

Else

End If

While [condici�n]
�.
End While
Ejecuta el c�digo en el ciclo �nicamente si la condici�n es True y se repite hasta
que la expresi�n evaluada sea False

You might also like