Console app class events item does not exist

This is my first console app and I am puzzled with class usage.

There is no page, so I started by adding an IPCSocket from the library to the project. When I tried to set IPCSocket.Path from the app.run event, I got an “Item does not exist” for the class.

So I placed a module, and added IPCSocket to the module as global.

Now when I try to set IPCSocket.Path in App.Run, I get “Item does not exist” for Path. IPCSocket is apparently recognized. The same happens for IPCSocket.Write, so apparently methods are inaccessible as well. And the inspector shows no properties as well.

In a desktop app, I would place an instance in a page to be able to access class instances properties and methods in code as well as in the inspector. How is that done in a console app ?

TIA

You need to create an instance (which is what happens when you drag a control onto a window or page). In a console app, you’d just have a property and then instantiate it in the Run event handler. To make it easier to get at the events, you’ll probably want to subclass it:

Property MySocket As IPCSocketSubclass

In Run event handler:

MySocket = New IPCSocketSubclass

[quote=111295:@Paul Lefebvre]You need to create an instance (which is what happens when you drag a control onto a window or page). In a console app, you’d just have a property and then instantiate it in the Run event handler. To make it easier to get at the events, you’ll probably want to subclass it:

Property MySocket As IPCSocketSubclass

In Run event handler:

MySocket = New IPCSocketSubclass

Thank you Paul. I will try to do that.

[quote=111295:@Paul Lefebvre]You need to create an instance (which is what happens when you drag a control onto a window or page). In a console app, you’d just have a property and then instantiate it in the Run event handler. To make it easier to get at the events, you’ll probably want to subclass it:

Property MySocket As IPCSocketSubclass

In Run event handler:

MySocket = New IPCSocketSubclass[/quote]

:frowning:

When I add a property to App called MySocket as IPCSocketSubclass I get [quote]There is no class by that name[/quote] . Same message in App.Run for MySocket = New IPCSocketSubclass

Then on second line I get [quote]Type mismatch error. Expected IPCSocketSubClass, but got Variant App[/quote]

You’ll have to of course add an actual IPCSocket subclass to your project.

  1. Add a class to the project
  2. Changes its Super to IPCSocket

[quote=111316:@Paul Lefebvre]You’ll have to of course add an actual IPCSocket subclass to your project.

  1. Add a class to the project
  2. Changes its Super to IPCSocket[/quote]

Duh. I had added one but forgot to change its name to IPCSocketSubclass. Thank you Paul.