Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim lCount As Integer
        For lCount = 1 To 5
            ListView1.Items.Add(lCount.ToString)
        Next

        If ListView1.Items.Count > 0 Then
            ListView1.Items(0).Selected = True
        End If

I have even write the code to select the first node,i want first row should be blue(Selected). But its not coming to be blue?

ListView1.View = View.Details
        ListView1.HideSelection = False
        ListView1.FullRowSelect = True

        Dim lCount As Integer
        ListView1.Columns.Add("No", 100)
        For lCount = 1 To 5
            ListView1.Items.Add(lCount.ToString)
        Next

        If ListView1.Items.Count > 0 Then
            ListView1.Items(0).Selected = True
        End If

hi adatapost,I already set view to details. I just set the tab order of listview to 0 & its done.

Dim lCount As Integer
        Dim lvitem As ListViewItem

        For lCount = 1 To 5
            lvitem = ListView1.Items.Add(lCount.ToString)
            lvitem.SubItems.Add("A")
        Next

        If ListView1.Items.Count > 0 Then
            ListView1.Items(0).Selected = True
            ListView1.Items(0).EnsureVisible()
        End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.