How to access a cell of an ObjectListView

BenTam-3003 681 Reputation points

Dear All,

How to access a cell of an ObjectListView (Not DataGridView) by row and column?

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.
8,199 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jack J Jun 23,661 Reputation points Microsoft Vendor

    @BenTam-3003 , Welcome to Microsoft Q&A, you could try the following code to access the cell of an ObjectListView by row index and column index.

    private void Form1_Load(object sender, EventArgs e)  
                objectListView1.Columns.Add(new OLVColumn("Name","Name"));  
                objectListView1.Columns.Add(new OLVColumn("Id", "Id"));  
                objectListView1.Columns.Add(new OLVColumn("Age", "Age"));  
                Student student1 = new Student() { Name="test1", Id=1003, Age=25};  
                Student student2 = new Student() { Name = "test2", Id = 1002, Age = 20 };  
                Student student3 = new Student() { Name = "test3", Id = 1001, Age = 21 };  
                List<Student> students = new List<Student>() { student1, student2, student3 };  
                //objectListView1.View = View.Details;  
            private void button1_Click(object sender, EventArgs e)  
                string value = GetResult(0, 2);  
                textBox1.Text= value;  
            public string GetResult(int row,int col)  
                List<object> list = new List<object>();  
                list = objectListView1.Objects.Cast<object>().ToList();  
                string value = objectListView1.GetColumn(col).GetStringValue(list[row]);  
                return value;  



    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful