This code is giving me an error:


The full code that the above is in is:

if (listBoxProxies.SelectedIndex < listBoxProxies.Items.Count - 1)
  listBoxProxies.SelectedIndex = listBoxProxies.SelectedIndex + 
        listBoxProxies.SetSelected(listBoxProxies.SelectedIndex, true);

I am working with proxies and basically I want my program to select a random proxy from a list that the user uploads. Can you help?

SelectedItem property returns an object by default. You will have to convert it to string.