By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,571 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,571 IT Pros & Developers. It's quick & easy.

System.AccessViolationException

P: n/a
I am getting the following error message in my WinForms project:

---

An unhandled exception of type 'System.AccessViolationException'
occurred in System.Windows.Forms.dll

Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.

---

I have narrowed the problem down to a TreeView - if the user is
currently editing the label of a TreeNode (using node.BeginEdit) and I
then add a new node to the TreeView, the exception gets thrown.

However - I cannot seem to programatically end the editing of the
TreeNode first (assuming that will stop the error). Can anyone direct
me to a solution please?

Thanks!

Oct 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"James Arnold" <ja****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>I am getting the following error message in my WinForms project:

---

An unhandled exception of type 'System.AccessViolationException'
occurred in System.Windows.Forms.dll

Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.

---
Do you get any callstack or any other useful information?

I have narrowed the problem down to a TreeView - if the user is
currently editing the label of a TreeNode (using node.BeginEdit) and I
then add a new node to the TreeView, the exception gets thrown.
Where/how are you adding the new node?
Can you reproduce the problem in a small program?

However - I cannot seem to programatically end the editing of the
TreeNode first (assuming that will stop the error). Can anyone direct
me to a solution please?
TreeNode.EndEdit perhaps

/claes
Oct 26 '06 #2

P: n/a
Source:
SourceLibrary.My.MyApplication
=IntPtr CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)

Message:
Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.

StackTrace:
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

Claes Bergefall wrote:
"James Arnold" <ja****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
I am getting the following error message in my WinForms project:

---

An unhandled exception of type 'System.AccessViolationException'
occurred in System.Windows.Forms.dll

Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.

---

Do you get any callstack or any other useful information?

I have narrowed the problem down to a TreeView - if the user is
currently editing the label of a TreeNode (using node.BeginEdit) and I
then add a new node to the TreeView, the exception gets thrown.

Where/how are you adding the new node?
Can you reproduce the problem in a small program?

However - I cannot seem to programatically end the editing of the
TreeNode first (assuming that will stop the error). Can anyone direct
me to a solution please?

TreeNode.EndEdit perhaps

/claes
Nov 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.