Hi Jeff,
>I have a grid on a form that I pass parameters to create the header names and control source for the columns. The grid is dynamic in that it can contain as many columns as it will handle. The problem is that I want to add a sort routine to the headers' click events so that the user can sort by clicking on the column header. But, I cannot see how to dynamically add the code to the click event (at runtime).
Create a header class (done in code) and add that to your columns. To make this header reusable so only one class needs to be defined, put this code in its Click method:
This.Parent.Parent.HeaderClicked(This)
Then you can put the code for the individual headers in the grid instance, or a class, or anything. Very nice. Make Sense?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only