Click here to Skip to main content
15,890,670 members
Home / Discussions / Visual Basic
   

Visual Basic

 
SuggestionRe: vb Pin
Richard MacCutchan2-Feb-16 22:11
mveRichard MacCutchan2-Feb-16 22:11 
GeneralRe: vb Pin
Sascha Lefèvre2-Feb-16 22:54
professionalSascha Lefèvre2-Feb-16 22:54 
QuestionRe: vb Pin
CHill604-Feb-16 4:01
mveCHill604-Feb-16 4:01 
GeneralRe: vb Pin
Sascha Lefèvre4-Feb-16 4:12
professionalSascha Lefèvre4-Feb-16 4:12 
AnswerRe: vb Pin
ZurdoDev9-Feb-16 8:16
professionalZurdoDev9-Feb-16 8:16 
Questionneed an urgent helpfor making graph and the values for those plotting graph to be taken from my excel files. Pin
Member 122569872-Feb-16 3:20
Member 122569872-Feb-16 3:20 
AnswerRe: need an urgent helpfor making graph and the values for those plotting graph to be taken from my excel files. Pin
Sascha Lefèvre2-Feb-16 4:07
professionalSascha Lefèvre2-Feb-16 4:07 
QuestionVB.Net AddHandler from inside an Event Pin
Member 1229351629-Jan-16 14:51
Member 1229351629-Jan-16 14:51 
I'm programming for my G15 LCD Keyboard.
When i press a button on the LCD it triggers the "ButtonPressed" event. When i press button 2 i want it to Add Handlers for my KeyboardHook for my Calculator.
The idea is that when i press button 2, my screen changes and my KeyboordHook starts listening, then i can enter calculations on my keyboard that are displayed on my LCD and processed when i hit enter.. Simple enough..

The problem is that i can't seem to find a way to add the Handlers for it while i'm already in an event..

The ButtonPress Event that starts the Calculator:
VB.NET
Dim Calculator As New Tools.LCDCalculator
Public Function ButtonPress(ByVal device As Integer, ByVal dwButtons As Integer, ByVal pContext As System.IntPtr) As Integer
    Calculator.StartCalculator()
End Function


And here's the Calculator Class:
VB.NET
Public Class LCDCalculator

    Public Active As Boolean

    Public Sub StartCalculator()
        Debug.WriteLine("Active")
        AddHandler HookManager.KeyPress, AddressOf HookManager_KeyPress
    End Sub

    Public Sub StopCalculator()
        Debug.WriteLine("Inactive")
        RemoveHandler HookManager.KeyPress, AddressOf HookManager_KeyPress
    End Sub

    Public Sub HookManager_KeyPress(sender As Object, e As KeyPressEventArgs)
        Debug.WriteLine(String.Format("KeyPress - {0}", e.KeyChar))
        e.Handled = True
    End Sub

End Class


I thought it might be threading or something so i tried doing this:
C#
Task.Run(Sub() Calculator.StopCalculator())

But no such luck ...

I can start the Calculator from anywhere else and it works flawlessly, but when i try adding that handler from in the ButtonPress event it doesn't seem to work..

Please advise
AnswerRe: VB.Net AddHandler from inside an Event Pin
Dave Kreskowiak1-Feb-16 3:41
mveDave Kreskowiak1-Feb-16 3:41 
QuestionVS2015 - MsFlexgrid not displaying when building form Pin
Denis Oxon28-Jan-16 14:33
Denis Oxon28-Jan-16 14:33 
AnswerRe: VS2015 - MsFlexgrid not displaying when building form Pin
Dave Kreskowiak28-Jan-16 16:02
mveDave Kreskowiak28-Jan-16 16:02 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Denis Oxon28-Jan-16 22:11
Denis Oxon28-Jan-16 22:11 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Mycroft Holmes28-Jan-16 22:56
professionalMycroft Holmes28-Jan-16 22:56 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Denis Oxon28-Jan-16 23:17
Denis Oxon28-Jan-16 23:17 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Mycroft Holmes28-Jan-16 23:20
professionalMycroft Holmes28-Jan-16 23:20 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Denis Oxon29-Jan-16 2:11
Denis Oxon29-Jan-16 2:11 
GeneralRe: VS2015 - MsFlexgrid not displaying when building form Pin
Dave Kreskowiak29-Jan-16 2:25
mveDave Kreskowiak29-Jan-16 2:25 
QuestionCalling BCP from .net on Windows 2012 Pin
byka28-Jan-16 7:15
byka28-Jan-16 7:15 
AnswerRe: Calling BCP from .net on Windows 2012 Pin
Dave Kreskowiak29-Jan-16 14:56
mveDave Kreskowiak29-Jan-16 14:56 
QuestionHow to print a full DataGridView (Urgent) Pin
Dorsaf Ouersighni25-Jan-16 22:15
Dorsaf Ouersighni25-Jan-16 22:15 
GeneralRe: How to print a full DataGridView (Urgent) Pin
Sascha Lefèvre25-Jan-16 22:40
professionalSascha Lefèvre25-Jan-16 22:40 
GeneralRe: How to print a full DataGridView (Urgent) Pin
Dorsaf Ouersighni25-Jan-16 22:52
Dorsaf Ouersighni25-Jan-16 22:52 
GeneralRe: How to print a full DataGridView (Urgent) Pin
Sascha Lefèvre25-Jan-16 23:00
professionalSascha Lefèvre25-Jan-16 23:00 
GeneralRe: How to print a full DataGridView (Urgent) Pin
Dorsaf Ouersighni25-Jan-16 23:33
Dorsaf Ouersighni25-Jan-16 23:33 
GeneralRe: How to print a full DataGridView (Urgent) Pin
Sascha Lefèvre26-Jan-16 0:06
professionalSascha Lefèvre26-Jan-16 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.