flipnjme

flipnjme

  • NA
  • 15
  • 0

checking for selection in listbox

Jul 26 2004 10:46 AM
I'm trying to check if a value from a list box is selected, right now if a value isn't selected and some one clicks add "I get specified argument was out of range of values". I figure maybe an if statement would work to check if anything was selected before the code is executed. Here is the code I have. public void Add_Click(object sender, System.EventArgs e) { ListViewItem item = listView1.SelectedItems[0]; Form1.FileSel = textBox1.Text; Form1.FileSize = item.SubItems[1].Text; Form1.selected = 1; this.Close(); } any help would be greatly appreciated.

Answers (2)