This commit is contained in:
2024-01-19 14:00:32 +00:00
parent 7c7c99dad4
commit 1dd49720e1
18 changed files with 857 additions and 7 deletions

34
Workshop2/Form1.cs Normal file
View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Workshop2
{
public partial class Form1 : Form
{
//Form2 f2 = new Form2();
public Form2 f2;
public Form1()
{
InitializeComponent();
}
private void showForm2button_Click(object sender, EventArgs e)
{
if (f2 == null)
{
f2 = new Form2();// you need to set the textbox in form2 to public
f2.textBox1.Text = "Initially Set from form1";// need to ensure if the form is closed it is dereferenced
f2.FormClosed += delegate {
f2 = null;
};
}
f2.Show();
}
}
}