hola.estoy ya loco perdido.no se que estoy haciendo mal.aqui pongo el codigo por si alguien me puede ayudar.
y es que no se como introducir el valor del puerto.como han quitado el mscomm del vb8.pues a aprender.
me dice: El puerto '1:' no existe. y eso que lo tengo abierto.
lo que hace el programa es mandar los codigos de las teclas de direccion al com1.al pulsarlas.
Imports System.IO.Ports 'para el uso del serial port
Public Class Form1
Dim dato As String
Dim portcom As String
Dim value As String
Dim instance As New SerialPort
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
value = 1
instance.PortName = value
If SerialPort1.IsOpen() Then SerialPort1.Close()
SerialPort1.Open() 'Abrimos el puerto para las comunicaciones.
End Sub
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If (e.KeyCode = System.Windows.Forms.Keys.Up) Then
'Up
End If
If (e.KeyCode = System.Windows.Forms.Keys.Down) Then
SerialPort1.Write("e.KeyCode", 0, dato.Length)
'Down
End If
If (e.KeyCode = System.Windows.Forms.Keys.Left) Then
SerialPort1.Write("e.KeyCode", 0, dato.Length)
'Left
End If
If (e.KeyCode = System.Windows.Forms.Keys.Right) Then
SerialPort1.Write("e.KeyCode", 0, dato.Length)
'Right
End If
If (e.KeyCode = System.Windows.Forms.Keys.Enter) Then
SerialPort1.Write("e.KeyCode", 0, dato.Length)
'Enter
End If
End Sub
End Class