views:

56

answers:

2

How do I force the Visual Studio compiler to generate an error when a required method is not being called in the constructor of a child class? Like when you edit the form designer code, the compiler complains when InitializeComponent()isn't the first call in the constructor of a form.

Is this even possible in VB.NET?

+2  A: 

Why not call that required method in the parent class's constructor?

Ankit
I didn't even think about that. It solves my problem for now, but I need to find a way to avoid duplicate calls to the method I'm requiring. Thanks for the help. :)
Heather
A: 

I don't know VB but maybe you can set a Boolean in the class, set it to true when the method is call and throw an exception if it's false. Just an idea.

Procule
I may have to do something like that to avoid duplicate calls to the method I am requiring, but I've solved my problem of the now a different way. Thanks for the input!
Heather