Random Crash in my .NET Program

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am getting a random crash in my program. I think it has to do with the
only listbox I have. It uses the WMP to play songs and when a song completes
I set the selected item in the listbox. I am assuming that is has to do with
the listbox because of this line:

"at System.Windows.Forms.ScrollableControl.WndProc(Message& m)"

and the listbox is the only part of my program that has a scrollable control.


Any help in fixing this would be greatly appreciated.

Here is the debug info:

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.



************** Exception Text **************

System.NullReferenceException: Object reference not set to an instance of an
object.

at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)

at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)

at System.Windows.Forms.Control.DefWndProc(Message& m)

at System.Windows.Forms.Control.WmUpdateUIState(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.ContainerControl.WndProc(Message& m)

at System.Windows.Forms.ParkingWindow.WndProc(Message& m)

at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)


Thanks,

Renzska
 
public void setSelected(int track)
{
listFormPlayList.SetSelected(track, true);
}

That is what I am doing. But I call it in a lot of different places. Could
that be the cause of my problem?

Thanks,

Renzska
 
Hello,

NullReferenceExceptions in this native methods mostly happen
when own code mixes something up while running inside
of the native window thread.

Are your sure that track in your method call

listFormPlayList.SetSelected(track, true);

is not set to some value out of range?


Greets, Sebastian Dau
 
Back
Top