private void Btn_Click(object sender, EventArgs e) { Button btn = (Button)sender; Jucator j = (Jucator)btn.Tag; textBox1.Text = j.Nume; textBox2.Text = j.Post; textBox3.Text = j.Cnp; }
private void button1_Click(object sender, EventArgs e) { Jucator obj = new Jucator(textBox1.Text, textBox2.Text, (Post)comboBox1.SelectedIndex); StreamWriter writer = new StreamWriter("D:\\LPF\\" + Form1.select_echipa + "\\" + textBox2.Text + ".lpf"); writer.WriteLine(textBox1.Text); writer.WriteLine(comboBox1.SelectedItem.ToString()); writer.Close(); }
private void AfisareJucatori(object sender, EventArgs e) { foreach (String path in Directory.EnumerateFiles("D:\\LPF\\" + comboBox1.SelectedItem.ToString(), "*.lpf")) { StreamReader reader = new StreamReader(path); String nume_juc = reader.ReadLine(); Button btn = new Button(); String post_str = reader.ReadLine(); var post = (Post)Enum.Parse(typeof(Post), post_str); Jucator jucator = new Jucator(nume_juc, Path.GetFileNameWithoutExtension(path), post); btn.Tag = jucator; btn.Text = nume_juc; btn.Width = 200; flowLayoutPanel1.Controls.Add(btn); btn.Click += Btn_Click; } }