scrollbar problem..
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

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)

Reply to this message...
 
    
mavisahdas (VIP)
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 Click here to reveal e-mail address, Click here to reveal e-mail address.

With regards,

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

"Paul Lo" wrote:

[Original message clipped]

Reply to this message...
 
    
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

"mavisahdas" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Mavisahdas
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
Reply to this message...
 
    
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

"Paul Lo" <Click here to reveal e-mail address> wrote in message
news:exja%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.IntPtr
System.NullReferenceException
System.Windows.Forms.ContainerControl
System.Windows.Forms.Control
System.Windows.Forms.NativeWindow
System.Windows.Forms.ScrollableControl
System.Windows.Forms.UserControl




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com