var choices = new Dictionary<string, string>();
choices["A"] = "Arthur";
choices["F"] = "Ford";
choices["T"] = "Trillian";
choices["Z"] = "Zaphod";
listBox1.DataSource = new BindingSource(choices, null);
listBox1.DisplayMember = "Value";
listBox1.ValueMember = "Key";
(Shamelessly lifted from my own blog: Bind a ComboBox to a generic Dictionary.)
This means you can use SelectedValue to get hold of the corresponding dictionary key for the selected item in the ListBox.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…