John Saunders [MVP]
10/10/2006 11:57:00 AM
<philaphan80@yahoo.com> wrote in message
news:1160444033.957409.72730@c28g2000cwb.googlegroups.com...
>> Things are different today than they were 30 years ago when I learned the
>> difference between compile-time and run-time, so I gave this some more
>> thought.
>
> John,
>
> First, let me thank you for taking time out of your schedule to help me
> with this. I appreciate it.
>
> One of your last comments worries me a bit, though. I'm afraid I may
> have misled you somehow.
>
>> Are you sure you didn't see these license things happen at design-time
>> and
>> not runtime?
>
> Actually, that was what I was trying to get at. I'm sorry if I said
> anything inaccurate that may have led you to draw the wrong conclusion.
>
> I'm basically looking for the action (error/warning) to take place
> during compile-time, if there is such a thing. So this would be
> between design-time and run-time, when I have manually chosen to
> compile (or build) my project. I'm hoping to produce a compile-time
> error within the IDE, similar to the ones that force you to fix them
> before recompiling (e.g. paraphrased: "The string 'test' cannot be
> converted to type Integer -- testing.vb: line 47"). That way, I
> wouldn't have to worry about run-time at all. I'd have to fix my error
> before the project even successfully compiles.
>
> Does that help clear things up at all?
It does. It can't be done, and probably shouldn't be done.
The compiler couldn't possibly know, for instance, that the property on your
control is being set by a piece of code in another assembly not in the
solution.
The right way to do this is at runtime, using ISupportInitialization.
John