title: How to set a listview FocusedItem programatically
body: <p>How can I set the FocusedItem property programatically?</p>
  
  <p>I've tried this so far with no success:</p>
  
  <pre><code>If lvw.FocusedItem Is Nothing Then
      If lvw.Items.Count &gt; 0 Then
      lvw.Focus()
      lvw.HideSelection = False
      lvw.Items(0).Selected = True
      lvw.Items(0).Focused = True
      lvw.FocusedItem = lvw.Items(0)
      lvw.Select()
      End If
  End If
  </code></pre>
  
  <p>btw the form where the listview is has not called the ShowDialog method yet.
  Can this be the reason for this not to work? </p>