开发者

select new added ListViewItem

开发者 https://www.devze.com 2023-01-23 23:00 出处:网络
I have Main and Detail forms.开发者_JAVA百科 The Main form has ListView1. I would like to select new added ListViewItem in ListView1 when user click Save button in Detail form. I have problem only whe

I have Main and Detail forms.开发者_JAVA百科 The Main form has ListView1. I would like to select new added ListViewItem in ListView1 when user click Save button in Detail form. I have problem only when I'm adding new item. When I modify and save existing item according item is selected after save command. I will appreciate for sample.


This code seems to work for me if I add it to the Save button handler in the second form:

    With Form1.ListView1
        .Items.Add("item from form2")

        For i As Integer = 1 To .Items.Count
            .Items(i - 1).Selected = (i = .Items.Count)
        Next
    End With
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号