Question

J'ai 2 projets dans ma solution.
Disons que Proj A et B. Proj

Proj A est d'avoir mon événement personnalisé. et même Proj Raising cet événement en utilisant la fonction de RaiseEvent Vb.net Et Proj B est en référence de Proj A.
Proj B ajoute gestionnaire pour proj Un événement de personnalisé.

mais mon événement personnalisé augmentation de dévers. Quelqu'un pourrait-il me peut expliquer comment puis-je faire.

Edit:

Proj A

Public Shared Event cardReadComplete(ByVal data As String)
 Public Sub kbHook_KeyDown(ByVal Key As Windows.Forms.Keys) 
  IO.File.AppendAllText("E:\log.log", Key.ToString() & vbCrLf)
 RaiseEvent cardReadComplete(encryptedData)
End Sub

Proj B

 Private Sub handleSwipeCardRequest(ByVal msgText As String)
        AddHandler CardReader.Main.cardReadComplete, AddressOf sendSwipeCardDetails
        CardReader.Main.cardReadComplete()
End Sub

J'appelle la fonction handleSwipeCardRequest d'abord, puis Raising son événement.

Était-ce utile?

La solution

Votre événement sera déclenché lorsque kbHook_KeyDown est appelée, en supposant qu'elle est appelée après la ligne de AddHandler est exécutée. Etes-vous sûr que la fonction est appelée KeyDown? Comme Hans dit Passant, vous pourriez manquer un mot-clé Poignées:

Public Sub kbHook_KeyDown(ByVal Key As Windows.Forms.Keys) Handles kbHook.KeyDown
    ...
End Sub

Autres conseils

Une autre façon:

AddHandler kbHook.KeyDown , AddressOf Me.kbHook_KeyDown
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top