Advertisement
Guest User

CSARF

a guest
Apr 7th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. namespace WindowsFormsApp1
  2. {
  3.     public partial class Form1 : Form
  4.     {
  5.         Global globals = new Global();
  6.  
  7.         public Form1()
  8.         {
  9.             InitializeComponent();
  10.  
  11.             comboBox1.Items.Add("Tim 1");
  12.             comboBox1.Items.Add("Tim 2");
  13.             comboBox1.Items.Add("Tim 3");
  14.             comboBox1.SelectedIndex = 0;
  15.             comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
  16.         }
  17.  
  18.         private void button1_Click(object sender, EventArgs e)
  19.         {
  20.             listBox1.Items.Clear();
  21.             string[] temp = new string[10];
  22.             if (comboBox1.SelectedIndex == 0)
  23.             {
  24.                 globals.team1 = string.Concat(textBox1.Text + ";");
  25.                 temp = globals.team1.Split(';');
  26.             }
  27.             if (comboBox1.SelectedIndex == 1)
  28.             {
  29.                 globals.team2 += textBox1.Text + ";";
  30.                 temp = globals.team2.Split(';');
  31.             }
  32.             if (comboBox1.SelectedIndex == 2)
  33.             {
  34.                 globals.team3 += textBox1.Text + ";";
  35.                 temp = globals.team3.Split(';');
  36.             }
  37.  
  38.             listBox1.Items.Add(globals.team1);
  39.             //for (int i = 0; i < temp.Length; i++) listBox1.Items.Add(temp[i]);
  40.         }
  41.  
  42.         class Global
  43.         {
  44.             public string team1;
  45.             public string team2;
  46.             public string team3;
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement