Assuming you are using WinForms to develop your project, and you have a form called Form1 with a ListBox called listBox1 , you can do this:
public Form1() { InitializeComponent(); listBox1.Click += OnListBoxItemClick; } private void OnListBoxItemClick(object sender, EventArgs e) { var form2 = new Form2(listBox1.SelectedItem); form2.ShowDialog(); }
Your Form2 class must have a constructor that accepts the selected element as a parameter.
source share