Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I add a _Load Event to a control - with a twist
    primarykey
    data
    text
    <p>In C#, I want to add a _ResizeEnd event to a DataGridView control. I have found some code to help with this (that allows adding a _ResizeEnd event to a usercontrol).</p> <pre><code>private void UserControl1_Load(object sender, EventArgs e) { ((Form)this.Parent).ResizeEnd += new EventHandler(UserControl1_ResizeEnd); } void UserControl1_ResizeEnd(object sender, EventArgs e) { MessageBox.Show("Resize end"); } </code></pre> <p>As noted, I want to adapt this to add the event to a DataGridView. What I could do is create a UserControl and dump a DataGridView control onto it, and implement the _ResizeEnd event as per the code above.</p> <p>However, the problem with that is that I want all the properties, methods and events of the DataGridView to remain exposed in the designer. I am not aware of an "easy" method of exposing them (i.e. exposing the child control methods etc to the parent usercontrol), aside from writing all the Get/Set / events / methods etc.</p> <p>I thought I could change the inheritance from: public partial class MyDataGridView : UserControl To: public partial class MyDataGridView : DataGridView</p> <p>This solves the problem of having all the DataGridView properties etc exposed to the usercontrol, but of course this doesn't move me forward, because the DataGridView class (unlike the UserControl Class), doesn't have a _Load event.</p> <p>So.... Can anyone tell me how to solve this problem?</p> <p>EDIT: By the way... I understood that SubClassing would be:</p> <pre><code>public partial class MyDataGridView : DataGridView </code></pre> <p>This does expose the DataGridView properties etc, but I lose the : UserControl inheritance, meaning that there is no _Load event exposed.</p> <p>I'm not sure how to inherit both the UserControl properties / methods and the DataGridView properties etc.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload