Sorry if this is a stupid question but I'm returning to programming after many many years and still gettin to grips with OOP.
In VB2008, I can get the demo files to run no problem. But if i try to write my own code based on the demos I get constant erros about 'reference to a non-shared member requires an object reference' and messages about 'handles' not being defined in a variable first when using event handlers. I can get round this by declaring a variable first then using that but I would realy like to know if i am doing something fundamentally wrong here. For example,
In the proximitydemo the library is refreneced like this...
Private Sub fmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wclAPI.Load()
End Sub
but in my programs I have to use...
Private Sub fmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As wcl.wclAPI = New wcl.wclAPI
x.Load()
End Sub
Which then works.
Dont worry, I'm not looking for a VB primer, i appreciate thats not what you are here for. But I am so confused about why it works one way with the demo code and not when I try to write the same code in my own programs ? As a beginner, its causing me some considerable confusion when having to dimension variables all over the place. Your demo code looks much easier to follow.
Is there something else I have to do to my VB environment to get it to work like the demo ? a reference or a system setting or something else ?
Cheers