Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clicking empty space in a listview??

Status
Not open for further replies.

Wings

Programmer
Feb 14, 2002
247
US
Hi,
Does any one know how to check a listbox which is row select
enabled to see if the row is empty? I have been having problems, as my program crashes if the user clicks on an empty row. I need to make it so that empty rows cannot be selected.

Thanks
 
At the beginning of the onClick event for the listbox (I assume it is called ListBox1) insert this code:

Code:
if (ListBox1->Items[ListBox1->ItemIndex] == "")
   {
    //Show a message (Optional)
    ShowMessage("Error!");
    //exit from the function
    return; 
   }

// else do anything you want
Bye, Rolandfg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top