I am looking for some VB Code to return XY coordinates of a touch input. So far I have this incomplete code. In debug mode the program crashes when the screen is touched and I don’t know how to handle and trap the event in VB. Any help kindly received.
Imports GT = Gadgeteer
Imports GTM = Gadgeteer.Modules
Imports Gadgeteer.Modules.GHIElectronics
Imports Microsoft.SPOT
Imports Microsoft.SPOT.Presentation
Imports Microsoft.SPOT.Presentation.Controls
Imports Microsoft.SPOT.Touch
Partial Public Class Program
Dim onOff As Boolean = False
Dim oldVal As Integer
Dim newVal As Integer
Dim counter As Integer
Dim potSetting As Double
Dim touchX As Integer
Dim touchY As Integer
Public Sub ProgramStarted()
timer.Start()
Debug.Print("Program Started")
Display.WPFWindow.TouchDown = New Microsoft.SPOT.Input.TouchEventHandler(WPFWindow_TouchDown)
Display.WPFWindow.TouchUp = New Microsoft.SPOT.Input.TouchEventHandler(WPFWindow_TouchUp)
Thanks but no joy.
This is the error shown but I have no experience of using ‘RaiseEvent’.
Public Event TouchDown(sender As Object, e As Microsoft.SPOT.Input.TouchEventArgs)’ is an event, and cannot be called directly. Use a ‘RaiseEvent’ statement to raise an event.
@ jasuk70 - Thanks very much, that was the code I needed. It looks like the Event is generated by the Display.WPFWindow so is not directly shown in the coding window.
@ David G - Hi David, apologies for the direct approach, but would you be willing to share a sample of the final VB code to interact with the touch abilities of the T35 display on VB?
I’ve been trying to follow your previous steps, but seem to have gotten a bit stuck!