@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;
objectListView1.SetObjects(students);
}
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;
}
Result:
Best Regards,
Jack
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.