>Are you saying *not* to put the working code in one specific event handler and then have the other even handlers point to it, but rather, create a totally separate method, and make all even handlers point to that? Is that a more mature coding habit?Yep, that's what Perry is saying and I agree with him 100%. =0)
~~Bonnie
>
>
>
>
>>I've done this numerous times by making another method with the code. Then this method can get called by the various events that need to.
>>
>>>I have code in an event handler that I want to use by various events, but I seem to have an overlay mismatch problem...
>>>
>>>The object is a DataGridView, and the working code is presently in the form.CellClick() event handler, like this:
>>>
>>> private void mmGridCustomers_CellClick(object sender, DataGridViewCellEventArgs e)
>>> {
>>> string CustNo = this.mmGridCustomers.GetCurrentRowPK().ToString();
>>> this.Job.GetJobsByCustNo(CustNo);
>>> }
>>>
>>>Now, I want to activate this same event handler code with another event of the grid, which is the RowHeaderMouseClick() event. In other words, I want the same thing to happen with each of these two possible user actions.
>>>
>>>In the Poperties page of the form designer IDE, when trying to assign the existing event handler to the RowHeaderMouseClick(), I noticed that the existing event handler does not appear in the dropdown list to choose from, and I guess I have figured out that it is becuase the two events have different "signatures" (is that how you say it?) because they have different parameters or overloads?
>>>
>>>So, I am presently doing this trick of just passing null values to the target event handler, since the parameters are not used in the method code anyway:
>>>
>>> private void mmGridCustomers_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
>>> {
>>> this.mmGridCustomers_CellClick(null,null);
>>> }
>>>
>>>
>>>It works, but is this a good practice, or is there a better or more proper way to handle this?