scrollbar problem..

P

Paul Lo

Dear all,

I'm writting a .net winForm application with C#, but I'm getting the
following exception when the user scrolls a scrollbar. The strange thing is
that the exception happens only some of the time, and seems pretty random.
However, once an exception occurs with a scrollbar and when I choose
'continue', that particular scrollbar will raise the exception everytime I
click on it from that point on.

Anyone encounter the same problem before? Any solution to this problem?
At the very least I wanna know how I could catch that exception..

Thanks~!
Paul


************** 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.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.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)
 
G

Guest

Hi paul,
Before answering this question... i want to know the following things

So you have a scroll bar control in ur application was is a scroll bar
attached to some other control.

Have u handled any event i mean do u have any Scroll event attached to that
scroll bar.

This null reference exception will occur only when the object is not
initialised or only when it is dereferenced. So, there are cases where the
objects get disposed... if you have any code written in the scroll event, pls
send me that code also.

Answer these question this will help me solving this problem.. you can reach
me at (e-mail address removed), (e-mail address removed).

With regards,

Sadha Sivam S,
Microsoft Community Star,
KMG Info Tech.
Vist http://www.dotnetspider.com for more dot net updates
 
P

Paul Lo

Hi Sadha,

Thanks for your reply. Actually I have both types of scrollbar that you
mentioned. I have a scrollbar control that is attached to a customer control
that I made. And Yes, I have the scroll event attached to this scrollbar
control. Besides, I am also using MDI, the mdi child got a scrollbar when it
is displayed inside the mdi parent form. Both of these scrollbars got the
same problem, occasionally. That really made me frustrated.

If there is some object that I forgot to initialize or dereferenced, guess
the error should happen every time, but it's not the case. It seems strange
to me that such exception is generated from
System.Windows.Forms.UnsafeNativeMethods.CallWindowProc, and in fact
everything in the call stack are internal method calls within the framework.

Hope the above could give you some clue to my problem..

Paul
 
G

Guest

hi paul,

Can u pls send the code of ur scroll event...

With regards,

Sadha Sivam S,
Microsoft Community Star,
KMG Info Tech,
Bangalore,
Mobile: 9880397583
 
C

Charles Collins

I have an application that is throwing the same error, but only when run
through terminal server. We have yet to see it in any other instance and it
is totally random and sporadic. A solution to this issue would be greatly
welcomed here too.
Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top