Thank you for your Help.
Here nw I can't get it to write to the bluetooth receiver, it will connect fine but whenever I get to the peerStream.WriteByte(a), it throws an exception.
NullReferenceException.
Is that because of the peerStream that does not get instancieted?
here is my code so far
-----------------------------------
Imports InTheHand.Net
Imports InTheHand.Net.Bluetooth
Imports InTheHand.Net.Sockets
Imports System.IO
Imports System.Net.Sockets
Imports System.Text
Imports InTheHand.Net.Sockets.BluetoothClient
Imports Microsoft.VisualBasic
Public Class Form1
Dim addr As BluetoothAddress = BluetoothAddress.Parse("00066600D722") 'etc etc
Dim a As Byte = Asc("a")
Dim b As Byte = Asc("b")
Dim c As Byte = Asc("c")
Dim ep As New BluetoothEndPoint(addr, BluetoothService.SerialPort)
Dim cli As New BluetoothClient
Dim peerStream As Stream
' Private Sub OpenDoor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenDoor.Click
'Dim peerStream As Stream = cli.GetStream()
' a = "110001"
'End Sub
Private Sub RollDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RollDown.Click
'Dim peerStream As Stream = cli.GetStream()
' b = "110010" 'b.
peerStream.WriteByte(b)
End Sub
Private Sub TurnonH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TurnonH.Click
peerStream.WriteByte(c)
End Sub
Private Sub Close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close.Click
cli.Close()
Me.Dispose()
End Sub
Private Sub door_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles door.Click
'Dim peerStream As Stream = cli.GetStream()
' a = "110001"
' cli.Connect(ep)
peerStream.WriteByte(a)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'peerStream = New Stream(cli.GetStream())
Try
If cli.Available = True Then
cli.Connect(ep)
peerStream = cli.GetStream()
Else
MessageBox.Show("Client not available,try again", "Error", MessageBoxButtons.OK, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
Catch es As NullReferenceException
MessageBox.Show("Connection to the receiver Failed")
End Try
End Sub
End Class
------------------------
Thanks for your hint.