Advertisement
Ecchijpbp

Programación 2 - Clase 3

Aug 28th, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. int index = 0;
  16.  
  17. public Form1()
  18. {
  19. InitializeComponent();
  20.  
  21. }
  22.  
  23. private void btnAumento_Click(object sender, EventArgs e)
  24. {
  25.  
  26. }
  27.  
  28. private void btnNeto_Click(object sender, EventArgs e)
  29. {
  30.  
  31. if (lstSueldos1.Items.Count > 0)
  32. {
  33. //for(index = 0; index <= lstEmpleados1.Items.Count-1; index++)
  34. while (index <= lstEmpleados1.Items.Count-1)
  35. {
  36. lstNeto.Items.Add(lstEmpleados1.Items[index].ToString() + " " +Convert.ToString(Convert.ToDouble(lstSueldos1.Items[index])+Convert.ToDouble(lstSueldos1.Items[index]) * Convert.ToDouble(txtAumento.Text)/100));
  37. index++;
  38. }
  39. }
  40. else
  41. {
  42. MessageBox.Show("La lista de sueldos se encuentra vacìa");
  43. }
  44.  
  45. }
  46.  
  47. private void btnCargar_Click(object sender, EventArgs e)
  48. {
  49. if (txtEmpleado.Text != "" && Convert.ToDouble(txtSueldo.Text) != 0)
  50. {
  51. lstEmpleados1.Items.Add(txtEmpleado.Text);
  52. lstSueldos1.Items.Add(txtSueldo.Text);
  53. txtEmpleado.Clear();
  54. txtSueldo.Clear();
  55. txtEmpleado.Select();
  56.  
  57. }
  58. else
  59. {
  60. MessageBox.Show("Cargue datos en los controladores");
  61. txtEmpleado.Select();
  62. }
  63. }
  64.  
  65. private void btnTotal_Click(object sender, EventArgs e)
  66. {
  67. double total = 0;
  68. for (int i = 0; i < lstNeto.Items.Count; i++)
  69. {
  70. total += Convert.ToDouble(lstSueldos1.Items[i] + Convert.ToDouble(lstSueldos1.Items[i]) * Convert.ToDouble(txtAumento.Text) / 100); //Aca hay un error por la concatenaciòn con texto
  71. }
  72. }
  73.  
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement