Attempted to read or write protected memory in mixed mode module-Collection of common programming errors

I am sorry; I should have understood what you meant by mixed mode.

The message saying that the program is attempting to access protected memory is saying that you have a pointer, index or subscript that has an invalid value. I am not sure how to debug that in managed code because I don’t have much experience with it but I will assume the following will help.

While in the debugger and when you have encountered the problem, look at the call stack; are you familiar with that? Look at the top-most line of the call stack that has a line of source code in your program. Double-click on that line and it will show that source code line. There is a problem there, either directly or indirectly.