I have done some changes to my coding and tested it. It is still not working perfectly hence i hope to have some guidance here.
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO.Ports
Partial Class Main
Inherits System.Web.UI.Page
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Dim Serialport7 As New IO.Ports.SerialPort
With Serialport7
.PortName = "COM7"
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
End With
Try
Serialport7.Open()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Dim ReceivedData As String
ReceivedData = Serialport7.ReadLine()
If ReceivedData.Substring(0, 1) = "T" Then
TextBox1.Text = ReceivedData.Remove(0, 1)
ElseIf ReceivedData.Substring(0, 1) = "H" Then
TextBox2.Text = ReceivedData.Remove(0, 1)
End If
TextBox3.Text = System.DateTime.Now
Serialport7.Close()
End Sub
End Class
The errors i have encountered:
TextBox2 is not displaying the reading, only TextBox1 is showing the reading.
The Web form is not refreshing hence my readings are not updated. Is there any way i can auto update the Web form ?
Appreciates all guidance. Thanks.