hi
Ich habe ein Problem Ich starte Form mit:
C#-Quelltext
1: 2: 3:
| System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new Form2(NameToForm)); |
NameToForm ist eine List mit mehreren Namen.
Und dann in Forms habe ich eine CheckedListBox in der die Namen ausgewählt werden können
Aber im wenn ich es durch laufen lasse werden im Forms keine CheckBoxen erzeugt und das Button Click funktioniert auch nicht
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31:
| public partial class Form2 : Form { List<String> ergebnis = new List<string>(); public Form2(List<String> NameAusBib) { ergebnis = null; InitializeComponent(); checkListBox = new CheckedListBox(); checkListBox.Location = new Point(10, 28); checkListBox.Size = new Size(271, 180); checkListBox.Text = "Namen"; foreach (String Name in NameAusBib) { checkListBox.Items.Add(Text = Name); } } private void buttonOK_Click(object sender, EventArgs e) { if (checkListBox.SelectedItem.ToString() != null) { ergebnis.Add(checkListBox.SelectedItem.ToString()); } else { MessageBox.Show("Wählen Sie minderstens einen Namen aus.", "Kein Namen Ausgewählt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } this.Close(); } CheckedListBox checkListBox; } |
Ich hoffe das mir einer helfen kann.
lg
Martin