samedi 28 février 2015

use a control in a different form but have a different event

i'm working on a project for school and have some logical errors. I have 2 different forms: frmOrders and frmCustomers. frmOrders is the main form and when i click a button here, frmCustomers will show. There is a datagrid named txtTable in frmCustomers.


Now, what i want to do is when I double click a row, some of the info goes in some textboxes in frmOrders then frmCustomers closes. Also, i want the rest of the controls in frmCustomers to be disabled. (I have set the access modifiers for the controls in frmCustomers as public but it does't seem to work.) How do I do that?


Currently this is my code:



public partial class frmOrders : Office2007Form
{
public frmOrders()
{
InitializeComponent();
}

private void frmOrders_Load(object sender, EventArgs e)
{

}

private void btnCustomer_Click(object sender, EventArgs e)
{
frmCustomers c = new frmCustomers();

c.ShowDialog();
c.txtAddress.Enabled = false;
c.txtBday.Enabled = false;
c.txtContactNo.Enabled = false;
c.txtFname.Enabled = false;
c.txtLname.Enabled = false;
c.txtMI.Enabled = false;
c.txtSearch.Enabled = false;
c.btnDelete.Enabled = false;
c.btnSave.Enabled = false;
c.btnUpdate.Enabled = false;

}
}

Aucun commentaire:

Enregistrer un commentaire