First problem:
You have an event which expects zero arguments.
You are trying to add a handler method which expects one argument - a
KeyEventArgs
instance.
Event handlers
MUST match the signature of the event they handle. If they don't, you get the compiler error shown in your screen-shot.
Second problem:
You have declared that
FnctionStartConsoleEvent
returns an event handler method which will accept two arguments -
sender As Object
and
args As ComboBox.ObjectCollection
.
The method does no such thing.
Since the method doesn't return anything, VB "helpfully" inserts a
Return Nothing
before the function exits. If you try to use the return value, you will get a
NullReferenceException
.
You need to start again, and read a few tutorials on how events work.
Events (Visual Basic)[
^]
Raising Events and Responding to Events[
^]
Walkthrough: Declaring and Raising Events (Visual Basic)[
^]
Step by Step: Event handling in VB.NET[
^]