Ok Ok Finally I had got solution for this problem and i would like to share it with my friends.....
I have added this function working clearly....
First I check there is any cross thread condition occur if yes then i fix it
Imports System.Data.OleDb
Imports System.IO.Ports
Public Class Student_Entry
Dim str12 As String
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim da As OleDbDataAdapter
Dim str As String
Dim icount As Integer
Dim rcount As Integer
Dim data As DataTable
Dim response As String, deviceadd As String
Dim c As Integer, i As Integer
Dim datareceive As String
Dim deviceNum As Integer, devicetemp As Integer
Private Sub Student_Entry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
For Each sp As String In SerialPort.GetPortNames
portcode = sp.ToString()
Next
With SerialPort1
.PortName = portcode
.BaudRate = 115200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.Two
.Open()
End With
Catch ex As Exception
MsgBox("Please Change Port setting")
End Try
End Sub
'Receiving data from serial port when device active
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
On Error Resume Next
With SerialPort1
response = ""
datareceive = SerialPort1.ReadExisting()
For i As Integer = 1 To Len(datareceive)
c = Asc(Mid(datareceive, i, 2))
response = response & Hex(c) & " "
Next
If Mid(response, 1, 2) = "7B" And Mid(response, 31, 2) = "7D" And Len(response) = 33 Then
deviceadd = Mid(response, 14, 11)
MsgBox(deviceadd) 'This msg box working properly
'Instead of below step we calling a method
' TextBox1.Text = deviceadd
call chekthread()
End If
End With
End Sub
'Check Thread cross
Private Sub chekthread()
Try
If (TextBox1.InvokeRequired) Then
TextBox1.Invoke(New MethodInvoker(AddressOf chekthread), New Object() {Text})
End If
TextBox1.Text = deviceadd.ToString()
Thanks to my self