I encountered this problem as well--as others have noted, .NET handles strings in a curious manner to improve memory management.  

My immediate workaround was to create a UniqueListItem class to be used in place of the strings I was planning to add to the listbox.  

class UniqueListItemObject
{
    private string _text;
    public string Text { get { return _text; } set { _text = value; } }

    public UniqueListItemObject(string input)
    {
        Text = input;
    }
    public UniqueListItemObject()
    {
        Text = string.Empty;
    }

    public override string ToString()
    {
        return Text;
    }
}


Because each instance of this object will get its own memory location, adding instances of this object to a listbox control instead of adding strings will result in unique selections, even if the strings displayed in the listbox are identical.

        yourListBox.Items.Add(new UniqueListItemObject(yourStringHere);


I can't say if this is the best solution (that depends on your project's requirements) but hopefully someone finds this helpful.

ListBox is selecting many items even in SelectionMode="Single"
I can think of two solutions:

1) Store hours, minutes, seconds, etc. in separate columns in the database


Downside: a lot of columns


2) Convert and store the number of seconds


We still want to be able to show seperate fields for hour, minute, second, etc. in the form. We could write virtual attribute for each of these and write a before_save callback that converts the timespan to seconds (still messy tho).


Am I missing some other obvious solution? How do you people do this?
