Hai,
I'm read temperature data using MSComm..
The temperature was successfully display on vb6..but how can I update/automatically refresh the temperature on web according to current temperature?
could you kindly please help me over here? thks!
Below is my coding:

Private Sub Form_Load()
MSComm1.PortOpen = True

MSComm1.Output = "temp" + Chr$(13)
'waits for 5 char to be recieved

Do
dummy = DoEvents()
Loop Until MSComm1.InBufferCount >= 20
'print value in text box
Text1.Text = MSComm1.Input

End Sub

Where are you reading the temperature from?

i'm using microcontroller pic16f877a to read the temperature...

What happens when you use the same code in VB.NET?

when i convert the code into vb.net2003, there was an error on do event() function..how to convert do event function in vb.net2003?
Do
dummy = DoEvents()----this line was error
Loop Until MSComm1.InBufferCount >= 20
'print value in text box
Text1.Text = MSComm1.Input

try this instead:

System.Windows.Forms.Application.DoEvents()

hi,
thanks..it's working! I can display the temperature on my web application...but, how to automatically update temperature on the form load rather than manually clicking the refresh button?

What's the code on the refresh button? Currenlty i think you were getting the temp. on the form load also.
You can do this by using a timer control on the form and make the interval "1000" which will be equal to 1 sec. Make the Timer Control Enabled by default, and write the code to refresh temp. in the timer control.

could you give an examples by using a timer control on the form? i hope i just can refresh the temperature only and not the whole page...

Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim MSComm1 As MSComm
        MSComm1 = New MSComm
        MSComm1.CommPort = 5 ' select Com1
        MSComm1.DTREnable = True
        MSComm1.EOFEnable = False
        MSComm1.InBufferSize = 1024
        MSComm1.InputMode = InputModeConstants.comInputModeText
        MSComm1.NullDiscard = False
        MSComm1.OutBufferSize = 512
        MSComm1.Settings = "38400,n,8,1" ' setting parameter in communicate with com port
        MSComm1.InputLen = 6 'define size of Input buffer (comming with Modem)
        If MSComm1.PortOpen = False Then
            MSComm1.PortOpen = True
        Else
            MSComm1.PortOpen = False
        End If

        'MSComm1.PortOpen = False
        'send RD0 command + CR
        MSComm1.Output = "temp" + Chr(13)
        'waits for 5 char to be recieved
        'into serial buffer (data + CR)

        Do
            DoEvents()
        Loop Until MSComm1.InBufferCount >= 20
        'print value in text box
        Label2.Text = MSComm1.Input

You can put the same code in the form load on the timer control and it will only refresh the textbox control with the new values. It will not load the form again but yes it redraws the form window. If its a web application you can update a particular without loading the whole page using AJAX.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.