In my application, I have a mainform which is the MdiParent of all other forms. On login, by default this form is opened and from menustrip in this form we are navigating to other forms like this:
public partial class MainMenuForm : Form
{
public MainMenuForm()
{
InitializeComponent();
this.WindowState = FormWindowState.Maximized;
}
private void humanResourceToolStripMenuItem_Click(object sender, EventArgs e)
{
HumanResourceForm humanresourceform = new HumanResourceForm();
humanresourceform.MdiParent = this;
humanresourceform.Show();
}
}
Inside the HumanResourceForm
I have a button which will navigate to another form say EmployeeTransferForm
:
private void button1_Click(object sender, EventArgs e)
{
Administraror.Humanresource.EmployeeTransferForm emptranfrm = new Administraror.Humanresource.EmployeeTransferForm();
emptranfrm.ShowDialog();
}
Now my problem is inside the EmployeeTransferForm
I want to get some values from the controls of HumanResourceForm
. Also the user should not be allowed to close the HumanResourceForm when the EmployeeTransferForm
is open or active.
I also want to get the Text property of a TextBox of HumanResourceForm
in EmployeeTransferForm
like:
public partial class EmpLoctnChangeForm : Form
{
public EmpLoctnChangeForm( )
{
InitializeComponent();
}
private void EmpLoctnChangeForm_Load(object sender, EventArgs e)
{
intemppk = humanresourceform.txtpk.text;
}
}
Expecting some nice advice from all.
Thanks in advance.