[Mono-winforms-list] NullReferenceException on SelectedValueChanged

Jon Cosby jon at jcosby.com
Sat Jul 7 12:21:38 EDT 2007

I have this event handler for SelectedValueChanged on a ListBox:

    private void SelectedValueChangedEvent(object sender, EventArgs e)
        string sFilename = fileListBox.SelectedValue.ToString();


There's a NullReferenceException at runtime,
"System.NullReferenceException: Object reference not set to an instance
of an object". What's up? Evidently the value has changed as it reaches
the handler. To null? The listbox is not empty.

Jon Cosby

More information about the Mono-winforms-list mailing list