Insert before the ShowDialog line:
C# code:
listbox1.SelectionChanged+=(_,e)=> {
var s = listbox1.SelectedItem as string;
print.it("SelectionChanged", s, listbox1.SelectedIndex);
};