Apr 082005
 

I’ve just been bitten by private declarations. When doubleclicking a component on a form, let’s say a button, you will be given a framework for the code and you can type what you like. In Delphi, you can reference libraries (without having to use the full prefix) that are in the uses-list. In C# you can not. The generated event (button1_Click) is defined as private, which (I have to look it up for the exact scoping) means that you cannot just use the objects/functions that you thought you’d included by “using” them.

Solution (it’s very simple, I know, but one has to learn one step at a time): create a new function, declared as public, and call that function from the event.

 Posted by at 23:36