| |

VerySource

 Forgot password?
 Register
Search
View: 663|Reply: 4

How do I make a row in the listview selected?

[Copy link]

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-22 10:20:01
| Show all posts |Read mode
Know the text value of Listview's Listitem. Based on this value, automatically make the corresponding Listitem in listview selected
I checked the previous information
How do I use it? Thank you
Reply

Use magic Report

0

Threads

4

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-4 10:45:01
| Show all posts
for (int i = 0; i <listview.count; i ++)
{
   if (text == listview [i] .tostring ())
   {
       listview [i] .selected = true;
    }
}
The general logic is like this, you can try it in the code.
Reply

Use magic Report

0

Threads

56

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-2-5 22:45:02
| Show all posts
for (int i = 0; i <listView1.Items.Count; i ++)
            {
                if (listView1.Items [i] .Text == str)
                    listView1.Items [i] .Selected = true;
            }
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-7 21:15:02
| Show all posts
Does HideSelection: False in the properties panel work?
I refer to Winform's ListView.
Reply

Use magic Report

1

Threads

10

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-8 10:45:01
| Show all posts
Controlled by the selected property of listview
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list