We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





772 Aug 16,2002 04:11 AM UTC Aug 16,2002 07:51 AM UTC WinForms 1
Tags: FAQ
Administrator [Syncfusion]
Asked On August 16, 2002 04:11 AM UTC

How do I programatically add rows of data in the listview. is it the same as the datagrid cell where you can add data in the cell by knowing its row number and column number? and how do i know which row has been clicked in the listview?

Clay Burch [Syncfusion]
Replied On August 16, 2002 07:51 AM UTC

To get the clicked row, you can use the SelectedItems collection and look at th eIndex of the first item in that collection. //C# int selectedRow = listView1.SelectedItems[0].Index; 'VB.NET Dim SelectedRow as Integer = listView1.SelectedItems(0).Index
To add a new item, you first create, and them call the Items.Add member of the ListView. This code adds a 4 column items ListViewItem newitem = new ListViewItem("new - 0",1); newitem.SubItems.Add("new - 1"); newitem.SubItems.Add("new - 2"); newitem.SubItems.Add("new - 3"); listView1.Items.Add(newitem);


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon