Saturday, August 20, 2011

keyboard working in web interface onkeypress event handler now working


keyboard now working in web interface

that was tricky
i had to prevent the return of the code 13 (enter) in the onkeypress handler
wich i use in my program, as you enter something in a textbox, then press enter or escape
or else my textbox was not returning a string type, but something else... tum tum tum...
that was poping a conversion type error

for escape, it was not returning anything because i cancel the input when esc is pressed

           AddHandler CType(flef, mshtml.HTMLDocumentEvents2_Event).onkeypress, AddressOf prekeylef
        AddHandler CType(fmid, mshtml.HTMLDocumentEvents2_Event).onkeypress, AddressOf prekeymid
        AddHandler CType(fbot, mshtml.HTMLDocumentEvents2_Event).onkeypress, AddressOf prekeybot


'==================


 Private Function prekeylef(ByVal e As mshtml.IHTMLEventObj) As Boolean
        'System.Console.Write("button clicked: " & e.srcElement.tagName.ToString() & vbCrLf)
        reskeylef = e.keyCode
        If reskeylef <> 13 And reskeylef <> 27 Then
            Return e.keyCode
        End If
        'System.Console.Write("keypressed " & reskeylef.ToString)
    End Function
    Private Function prekeymid(ByVal e As mshtml.IHTMLEventObj) As Boolean
        'System.Console.Write("button clicked: " & e.srcElement.tagName.ToString() & vbCrLf)
        reskeymid = e.keyCode
        If reskeymid <> 13 And reskeymid <> 27 Then
            'eee
            'MsgBox(" keycode" & reskeylef.ToString)
            Return e.keyCode
        End If


        'System.Console.Write("button clicked: " & resbutmidstr & vbCrLf)
    End Function
    Private Function prekeybot(ByVal e As mshtml.IHTMLEventObj) As Boolean
        'System.Console.Write("button clicked: " & e.srcElement.tagName.ToString() & vbCrLf)
        reskeybot = e.keyCode
        If reskeybot <> 13 And reskeybot <> 27 Then
            Return e.keyCode
        End If


        'System.Console.Write("button clicked: " & resbutbotstr & vbCrLf)
    End Function

1 comment:

  1. Programming Corner Wildboy85: Keyboard Working In Web Interface Onkeypress Event Handler Now Working >>>>> Download Now

    >>>>> Download Full

    Programming Corner Wildboy85: Keyboard Working In Web Interface Onkeypress Event Handler Now Working >>>>> Download LINK

    >>>>> Download Now

    Programming Corner Wildboy85: Keyboard Working In Web Interface Onkeypress Event Handler Now Working >>>>> Download Full

    >>>>> Download LINK AY

    ReplyDelete