title: How to change listview selected row backcolor even when focus on another control?
body: <p>I have a program which uses a barcode scanner as input device so that means I need to keep the focus on a text box.</p>
  
  <p>The program has a listview control and I select one of the items programatically when a certain barcode is scanned. I set the background color of the row by:</p>
  
  <pre><code>listviewitem.BackColor = Color.LightSteelBlue;
  </code></pre>
  
  <p>Things I have tried:</p>
  
  <ul>
  <li><code>listview.HideSelection</code> set to false</li>
  <li>call <code>listview.Focus()</code> after setting the color</li>
  <li><code>listviewitem.Focused</code> set to true</li>
  <li>call <code>listview.Invalidate</code></li>
  <li>call <code>listview.Update()</code></li>
  <li>call <code>listview.Refresh()</code></li>
  <li>different combinations of the above</li>
  </ul>
  
  <p>I've also did combinations above stuff in a timer so that they are called on a different thread but still no success.</p>
  
  <p>Any ideas?</p>
  
  <p>More info:</p>
  
  <ul>
  <li>The key here is the control focus. The <strong>listview control does not have the focus</strong> when I select one of the items.</li>
  <li><p>I select one item by doing:</p>
  
  <pre><code>listView1.Items[index].Selected = true;
  </code></pre></li>
  <li><p>the Focus is always in the textbox.</p></li>
  <li>the computer does not have keyboard or mouse, only a barcode reader.</li>
  </ul>
  
  <p>I have this code to keep the focus on the textbox:</p>
  
  <pre><code>private void txtBarcode_Leave(object sender, EventArgs e)
  {
     this.txtBarcode.Focus();
  }
  </code></pre>
  
  <p>You need to have a textbox add that code to simulate my problem.</p>