ChewDoggie
Programmer
G'morning All,
I have, in the past, been able to wire up events in an MDIParent Form with the following code:
So that when the Child Form in question is closing, the "onFormClosing" (in the MDIParent) code executes. And it works.
Now, I'd like to execute some code on the MDIParent when a row is selected on a DataGridView on a Child Form. I've tried the following code but it keeps complaining:
The Error is: "DataGridViewCellEventArgs does not contain a constructor that takes '1' argument".
I don't understand why the first code snippet executes OK and the second code snippet doesn't.
BTW...the access modifier for dgAssociates was changed to "public".
If someone could enlighten me and point me in the right direction, that'd be great.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.
I have, in the past, been able to wire up events in an MDIParent Form with the following code:
Code:
private void smnuCheckin_Click( object sender, EventArgs e )
{
frmCheckin = new CheckInItem(); // create new frmChecking object
frmCheckin.MdiParent = this; // set mdiparent
frmCheckin.Show(); // show the form
[COLOR=red]frmCheckin.FormClosing += new System.Windows.Forms.FormClosingEventHandler( onFormClosing );[/color]
smnuCheckin.Enabled = false;
}
private void onFormClosing( object sender, System.Windows.Forms.FormClosingEventArgs e )
{
if ( sender.ToString().Contains( "Juvenile" ) )
{
smnuChild.Enabled = true;
}
else if ( sender.ToString().Contains( "Check-In" ) )
{
smnuCheckin.Enabled = true;
}
else if ( sender.ToString().Contains( "Check-Out" ) )
{
smnuCheckout.Enabled = true;
}
else if ( sender.ToString().Contains( "Add Item" ) )
{
smnuAddItem.Enabled = true;
}
else if ( sender.ToString().Contains( "About" ) )
{
mnuAbout.Enabled = true;
}
else
{
smnuAdult.Enabled = true;
}
}
So that when the Child Form in question is closing, the "onFormClosing" (in the MDIParent) code executes. And it works.
Now, I'd like to execute some code on the MDIParent when a row is selected on a DataGridView on a Child Form. I've tried the following code but it keeps complaining:
Code:
private void ssmnuCompanySelect_Click(object sender, System.EventArgs e)
{
Company = new frmCompany();
Company.MdiParent = this;
Company.Show();
[COLOR=red]Company.dgAssociates.RowEnter += new DataGridViewCellEventArgs(onGridClicking);[/color]
}
private void onGridClicking(object sender, DataGridViewCellEventArgs e)
{
if (sender.ToString().Contains("Select Associate"))
{
lblStatusStrip.Text = string.Format("{0} {1} ({2})", AssocFName, AssocLName, AssocID);
}
}
The Error is: "DataGridViewCellEventArgs does not contain a constructor that takes '1' argument".
I don't understand why the first code snippet executes OK and the second code snippet doesn't.
BTW...the access modifier for dgAssociates was changed to "public".
If someone could enlighten me and point me in the right direction, that'd be great.
Chew
10% of your life is what happens to you. 90% of your life is how you deal with it.