Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click If (lstPorts.SelectedIndex -1) Then Else "ERROR" to say something wrong in connection. This button click will recive a messege in consol as "OK" to confirm that bluetooth is connected with the device. MsgBox("Please choose a serial port", vbInformation, "Serial Port")Ĭlick the Button "Bluetooth Test" and replace the code. To initialize the button "Connect" replace the button code with Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If lstPorts.SelectedIndex -1 Then Imports System.Threading Public Class Form1ĭelegate Sub myMethodDelegate(ByVal As String)ĭim bD1 As New myMethodDelegate(AddressOf process)ĭim WithEvents SerialPort As New IO.Ports.SerialPort Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DisposedĪnd below the code of Form1_Load Sub GetSerialPortNames() For Each sp As String In My.Įnd Sub Sub SendSerialData(ByVal Port As String, ByVal data As String)Įnd Sub Sub process(ByVal myString As String) buffer = buffer + myStringĭim words As String() = str.Split(New Char() )Įnd Sub Private Sub SerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceivedĭim str As String = SerialPort.ReadExisting()Įnd Sub Private Sub SerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived Dim str As String = SerialPort.ReadExisting() Then add some additional code above the Form1_Load code to get your comm port and some function to work with your software Imports System.IO First Form load code.To do so double click in any where in the form and change the code to Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Now we program every components of the Form.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |