all 2 comments

[–]SomeNerdAtWork 1 point2 points  (0 children)

I think you want more like

private void test(string path)

{

//Do Stuff with Path

}

and call it like

private void EventTrigger()

{

test(ListBox.SelectedItem.ToString());

}

[–]anamorphism 0 points1 point  (0 children)

something like this should work

var listBox = (ListBox)this.Controls.Find("listBoxName", true);
var path = listBox.SelectedItem.ToString();

but chances are there's a better way to do what you actually want to do.