Private Sub SMSPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles comPort.DataReceived
Dim str As String = ""
Dim temp As String = ""
objCon.GetConnectionString()
If e.EventType = SerialData.Chars Then
SMSPort.DtrEnable = True
System.Threading.Thread.Sleep(100)
tempp = SMSPort.ReadExisting().Replace(">", "").Trim()
If tempp.Length > 12 Then tempp = tempp.Substring(0, 12)
If tempp <> "" Then
objCon.GetConnectionString()
objCon.GetConnection("Insert into tblAttended(Id,Status,Date,Time)values('" + tempp.ToString() + "','In','" + System.DateTime.Today.ToShortDateString() + "','" + DateTime.Now.ToShortTimeString() + "')")
ListView1.Items.Add(tempp) //Error
txtUniqueNumber.Text = tempp.Trim()
ListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent) //Error
End If
Control.CheckForIllegalCrossThreadCalls = False
End Sub