Creating a new class in VB.NET is supposed to be easy. But, when I tried to use the class in the vb file, there was error - "Object Reference not set.". I didn't know why. Some of the things that I tried:
I removed the txtDesc.txt object since the error is pointing to this. But, this one didn't work and the error suddenly points to a new object.
I tried to use another procedure from this class. And same error appeared.
I tried to re-create the procedure btnAdd_click. I figured maybe, I wasn't able to copy the exact procedure.
Everything didn't work.
But, when I tried to check the declaration of my class:
Dim clsModule as LMAdmin_Module
I suddenly realized that ooopppps...I must have forgot something. And I was right. The declaration of the class was not right. It should be:
Dim clsModule as New LMAdmin_Module
With just one missing word, and the entire procedure is in jeopardy. That is how declarations are very important in VB.NET.
I hope you learned something in my little bug. :)
0 Response to "Creating a New Class"
Post a Comment