Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Vervang Form2 door de naam van het andere form
- // Vervang comboBox1 door de naam van je combobox in het tweede form
- public partial class Form1 : Form {
- Form2 mySecondForm;
- public Form1() {
- InitializeComponent();
- mySecondForm = new Form2();
- }
- private void button1_Click(object sender, EventArgs e) {
- string username = textBox1.Text;
- ComboBox cmboBox = ((ComboBox)mySecondForm.Controls.Find("comboBox1", true).FirstOrDefault());
- cmboBox.Items.Add(username);
- }
- private void button2_Click(object sender, EventArgs e) {
- mySecondForm.Show();
- this.Hide();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment