using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Deckungsbeitrag { public partial class FormProgrammauswahl : Form { public Button but; public FormProgrammauswahl() { InitializeComponent(); } private void FormProgrammauswahl_Load(object sender, EventArgs e) { //int idx = 0; foreach (string s in ConfigurationManager.AppSettings["Programme"].Split(',')) { //get_PR_button(s); this.panelProgramme.Controls.Add(get_PR_button(s)); } } private Button get_PR_button(string PRNr) { Button btn = new Button(); btn.Text = PRNr; btn.Size = new Size(250, 50); btn.Click += new EventHandler(this.btn_Click); btn.ForeColor = Color.White; btn.Font = new Font("Microsoft Sans Serif", 20, FontStyle.Bold); return btn; } private void btn_Click(object sender, EventArgs e) { //AUSWAHL IN DATENSATZ SPEICHERN UND FORM SCHLIESSEN but = (Button)sender; this.DialogResult = DialogResult.OK; this.Close(); } } }