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

Get Selected Item in single listview selection

Thread ID:





146087 Jul 19,2019 12:29 AM UTC Jul 22,2019 06:39 AM UTC WinForms 3
Tags: SfListView
Asked On July 19, 2019 12:29 AM UTC

How to get the selected value from a listview?
My code:

private void sfListView1_DoubleClick(object sender, EventArgs e)

            //Texto da seleção
            string Seleção = sfListView1.SelectedItems[0].ToString();
            //Pego o número do pedido
            /*string Pedido = Seleção.Substring(0, Seleção.IndexOf("-"));
            string Cliente = Seleção.Substring(Seleção.IndexOf("-"), Seleção.IndexOf("-"));


The code returns the name of the collection and not the selected item

Jagadeesan Pichaimuthu [Syncfusion]
Replied On July 19, 2019 10:29 AM UTC

Hi Matheus, 
Thanks for using Syncfusion product. 
We have checked the reported issue in our end and we found you directly show the selected item in message. Instead that you can cast the selected item to particular type of data which you bind with control as like the below code snippet. Here we populated the datasource with the collection of USState type, so we can cast the SelectedItem to particular type. 
void sfListView1_DoubleClick(object sender, EventArgs e) 
    //Texto da seleção 
    string Seleção = (sfListView1.SelectedItems[0] as USState).LongName.ToString(); 
We have prepared the simple sample to achieve your requirement. 
Please refer the below screen shot for your reference. 
Let us know whether this helps also if you need any further assistance on this. 

Replied On July 20, 2019 12:53 PM UTC

This work! Thanks!

Jagadeesan Pichaimuthu [Syncfusion]
Replied On July 22, 2019 06:39 AM UTC

Hi Matheus, 
Thanks for the update. 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 


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