@james114, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project
See About the Installation & Troubleshooting category.
FYI, your code in post #3 will not compile.
// Edit:
Did you run the runtime error through the exception decoder? It will tell you where it fails which might or might not be a pointer to the problem.