Share via

Where to put the delegate statement

BenTam-3003 686 Reputation points
2022-02-15T10:02:41.263+00:00

Dear All,

According to the webpage http://objectlistview.sourceforge.net/cs/recipes.html#how-can-i-put-a-button-into-a-cell, I can use a delegate statement to get the 'RowIndex' of the current row. I'd like to know where should I put the delegate statement?

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Castorix31 91,876 Reputation points
2022-02-15T14:04:31.563+00:00

You just add it after the creation/initialization of the ObjectListView

For example with an OLV named dataListView1, in Form1_Load :

            dataListView1.ButtonClick += delegate (object dlvsender, CellClickEventArgs ea)  
            {  
                System.Windows.Forms.MessageBox.Show(String.Format("Button clicked: ({0}, {1}, {2})", ea.RowIndex, ea.SubItem, ea.Model), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);  
                dataListView1.RefreshObject(ea.Model);  
            };  

Test :

174541-olv-button.gif

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.