Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/04/2011, 17:09
Avatar de culd
culd
 
Fecha de Ingreso: noviembre-2003
Mensajes: 959
Antigüedad: 21 años, 4 meses
Puntos: 19
Respuesta: codigo visual basic

Esta mal, por que estas usando un IF dentro de otro, es decir que si la primer condicion no se cumple, directamente no sigue... Lo logico seria...

Código vb:
Ver original
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  2. Dim pc As Integer
  3. Dim mac As Integer
  4. Dim contestador As Integer
  5. Dim calculadora As Integer
  6. Dim fotocopiadora As Integer
  7. Dim suma As Integer
  8. If RadioButton1.Checked = True Then
  9. pc = 1000000
  10. end if
  11. If RadioButton2.Checked = True Then
  12. mac = 2000000
  13. end if
  14. If CheckBox1.CheckState = 1 Then
  15. contestador = 300000
  16. end if
  17. If CheckBox2.CheckState = 1 Then
  18. calculadora = 100000
  19. end if
  20. If CheckBox2.CheckState = 1 Then
  21. fotocopiadora = 700000
  22. End If
  23.  
  24. suma = pc + mac + contestador + calculadora + fotocopiadora
  25. TextBox1.Text = Str(suma)
  26.  
  27. End Sub