How to get 'RowIndex' of an 'ObjectListView'

BenTam-3003 686 Reputation points
2022-02-14T08:22:10.997+00:00

Dear All,

How to get the last row number of an 'ObjectListView'? I search in Google and find the page http://objectlistview.sourceforge.net/cs/recipes.html#how-can-i-put-a-button-into-a-cell. In (52), I find the code as follows.

this.olv.ButtonClick += delegate(object sender, CellClickEventArgs e) {
    Debug.WriteLine(String.Format("Button clicked: ({0}, {1}, {2})", e.RowIndex, e.SubItem, e.Model));

I also know there is a 'RowsPerPage' property.

Which one should I use, 'RowsPerpage' or 'delegate'? I have no knowledge of 'delegate'. If 'delegate' is the final answer, where to put it?

C#
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.
10,843 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 84,471 Reputation points
    2022-02-14T09:48:04.447+00:00

    How to get the last row number of an 'ObjectListView'?

    The last is just the number of items - 1 :

    int nLastIndex = objectListView1.Items.Count - 1;
    

0 additional answers

Sort by: Most helpful

Your answer

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