earvinnill
New member
- Joined
- Aug 16, 2016
- Messages
- 4
- Programming Experience
- 5-10
I'm having a problem about closing the port, because everytime i close the port, my program freezes.
VB.NET:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click, Button2.TextChanged, RichTextBox2.TextChanged
Try
If SerialPort1.IsOpen Then
CloseComPort()
End If
RichTextBox1.Text = FormatNumber(CDbl(RichTextBox2.Text.ToString), 4)
mysql.Open()
Dim query As String = "INSERT into test.earvin (measure) VALUES ('" + RichTextBox2.Text + "')"
Dim cmd As New MySqlCommand(query, mysql)
cmd.ExecuteNonQuery()
MsgBox("Connected")
mysql.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
RichTextBox2.Clear()
RichTextBox1.Clear()
End Sub