martes, 31 de agosto de 2010

SOLUCION DEL EXAMEN SEGUNDO A-B


Private Sub CommandButton1_Click()
If ComboBox1.ListIndex = 0 Then
TextBox3 = Val(TextBox1) + Val(TextBox2)
Else
If ComboBox1.ListIndex = 1 Then
TextBox3 = Val(TextBox1) - Val(TextBox2)
Else
If ComboBox1.ListIndex = 2 Then
TextBox3 = Val(TextBox1) * Val(TextBox2)
Else
If ComboBox1.ListIndex = 3 Then
TextBox3 = Val(TextBox1) / Val(TextBox2)
Else
If ComboBox1.ListIndex = 4 Then
TextBox3 = Val(TextBox1) ^ Val(TextBox2)
End If
End If
End If
End If
End If
ListBox1.AddItem TextBox3
End Sub

Private Sub CommandButton2_Click()
End
End Sub

Private Sub CommandButton3_Click()
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
End Sub

Private Sub CommandButton4_Click()
If ListBox1.ListIndex = 0 Then
ListBox1.RemoveItem 0
Else
If ListBox1.ListIndex = 1 Then
ListBox1.RemoveItem 1
Else
If ListBox1.ListIndex = 2 Then
ListBox1.RemoveItem 2
Else
If ListBox1.ListIndex = 3 Then
ListBox1.RemoveItem 3
Else
ListBox1.RemoveItem 4
End If
End If
End If
End If
End Sub


Private Sub UserForm_Initialize()
ComboBox1.AddItem "SUMA"
ComboBox1.AddItem "RESTA"
ComboBox1.AddItem "MULTIPLICACION"
ComboBox1.AddItem "DIVISION"
ComboBox1.AddItem "POTENCIA"
End Sub

No hay comentarios:

Publicar un comentario