Samarth
Samarth

Reputation: 36

sender parameter is null in ListBox.SelectedIndexChanged

I have a WinForm application with a ListBox containing few list items. In the InitializeComponent(), The ListBox has a listBoxSelectedIndexChanged event attached.

By default, the first item is selected and SelectedIndexChanged event gets triggered but sender parameter is null, in the listBoxSelectedIndexChanged(object sender, System.EventArgs e).

Only after I click on an item in the ListBox, the sender parameter holds some value.

Any possible solutions so that sender parameter holds some value if the ListBox has first item preselected?

Upvotes: 0

Views: 119

Answers (0)

Related Questions