Guest User

Untitled

a guest
Sep 8th, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.87 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.Windows.Forms;
  9. using System.IO;
  10.  
  11. namespace OtotdikFeladat_kesz
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.         int meret = 0;
  20.         int[] homerseklet = new int[31];
  21.         string[] ujhomerseklet = new string[40];
  22.  
  23.         string[] honapok = new string[] {"Január",
  24.                                             "Február",
  25.                                             "Március",
  26.                                             "Április",
  27.                                             "Május",
  28.                                             "Június",
  29.                                             "Július",
  30.                                             "Augusztus",
  31.                                             "Szeptember",
  32.                                             "Október",
  33.                                             "November",
  34.                                             "December", };
  35.  
  36.         private void buttonOK_Click(object sender, EventArgs e)
  37.         {
  38.             if (comboBoxHonap.SelectedIndex == 0)
  39.             {
  40.                 StreamReader f = File.OpenText("homerseklet.txt");
  41.                 StreamWriter fki = File.CreateText("fokok.txt");
  42.  
  43.                 while (!f.EndOfStream)
  44.                 {
  45.                     homerseklet[meret] = Convert.ToInt32(f.ReadLine());
  46.                     meret++;
  47.                 }
  48.  
  49.                 f.Close();
  50.  
  51.                 for (int i = 0; i < meret; i++)
  52.                 {
  53.                     listBoxKi.Items.Add(homerseklet[i]);
  54.  
  55.                     for (int j = 0; j < meret; j++)
  56.                     {
  57.                         ujhomerseklet[0] = honapok[0];
  58.                         ujhomerseklet[j + 1] = Convert.ToString(homerseklet[i]);
  59.  
  60.                         for (int k = 0; k < ujhomerseklet.Length; k++)
  61.                         {
  62.                             fki.WriteLine(ujhomerseklet[k]);
  63.                         }
  64.                     }
  65.                 }
  66.             }
  67.         }
  68.  
  69.         private void Form1_Load(object sender, EventArgs e)
  70.         {
  71.             comboBoxHonap.SelectedIndex = 0;
  72.  
  73.             if (comboBoxHonap.SelectedIndex == 0)
  74.             {
  75.                 buttonOK.Enabled = true;
  76.             }
  77.  
  78.             else if (comboBoxHonap.SelectedIndex == 1)
  79.             {
  80.                 buttonOK.Enabled = true;
  81.             }
  82.  
  83.             else if (comboBoxHonap.SelectedIndex == 2)
  84.             {
  85.                 buttonOK.Enabled = true;
  86.             }
  87.  
  88.             else if (comboBoxHonap.SelectedIndex == 3)
  89.             {
  90.                 buttonOK.Enabled = true;
  91.             }
  92.  
  93.             else if (comboBoxHonap.SelectedIndex == 4)
  94.             {
  95.                 buttonOK.Enabled = true;
  96.             }
  97.  
  98.             else if (comboBoxHonap.SelectedIndex == 5)
  99.             {
  100.                 buttonOK.Enabled = true;
  101.             }
  102.  
  103.             else if (comboBoxHonap.SelectedIndex == 6)
  104.             {
  105.                 buttonOK.Enabled = true;
  106.             }
  107.  
  108.             else if (comboBoxHonap.SelectedIndex == 7)
  109.             {
  110.                 buttonOK.Enabled = true;
  111.             }
  112.  
  113.             else if (comboBoxHonap.SelectedIndex == 8)
  114.             {
  115.                 buttonOK.Enabled = true;
  116.             }
  117.  
  118.             else if (comboBoxHonap.SelectedIndex == 9)
  119.             {
  120.                 buttonOK.Enabled = true;
  121.             }
  122.  
  123.             else if (comboBoxHonap.SelectedIndex == 10)
  124.             {
  125.                 buttonOK.Enabled = true;
  126.             }
  127.  
  128.             else if (comboBoxHonap.SelectedIndex == 11)
  129.             {
  130.                 buttonOK.Enabled = true;
  131.             }
  132.         }
  133.     }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment