paxa
Posts: 2
Joined: Wed Jul 09, 2008 3:04 pm

vb2005 on read event not firing

Wed Jul 09, 2008 3:40 pm

Hi

and sorry if this is not the correct place for this post.
If so, please redirect me to the appropriate place.

now to my problem.

I've been trying to read data from a device just like the one on the link http://www.tylertool.com/mi540to5diin2.html but i'm not getting anything from it, i'm using visual studio 2005 and serialnet, and the device connected to the com1 port.

I've been using this code to try to connect and get a read from the device:

Code: Select all

 Dim WithEvents PSTESTE As New SerialNET.Port
    Private licence As New SerialNET.License
    dim rsbuffer As String
    dimbuffermitu As String



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PSTESTE.ComPort = 1
        PSTESTE.BaudRate = 9600
        PSTESTE.BufferSize = 8
        PSTESTE.StopBits = SerialNET.StopBits.One
        PSTESTE.Parity = SerialNET.Parity.No
        licence.LicenseKey = "key"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try


            PSTESTE.Enabled = True

        Catch ex As Exception
        End Try
    End Sub

    Private Sub psteste_OEventMitu(ByVal Data As String) Handles PSTESTE.OnRead
        Try
            rsbuffer += Data
             If rsbuffer.IndexOf(vbNewLine) > 0 Then
                Analisadados(Me)
            End If
        Catch ex As Exception

        End Try
    End Sub

Private Sub Analisadados(ByRef pf As Form1)
        Try
            Dim strbuffer As String = ""
            buffermitu = rsbuffer

        Catch ex As Exception

        End Try
    End Sub
while debugging the the following code the onread event doesn't do anything, it doesn't trigger at all

Any ideas?

help would be appreciated
thanks in advance

paxa
Posts: 2
Joined: Wed Jul 09, 2008 3:04 pm

RE: vb2005 on read event not firing

Tue Jul 29, 2008 8:40 pm

anyone?
i've tried every single kind of code that exists and nothing.
i can't get any data from the device

help would be appreciated

TimH
Posts: 12
Joined: Thu Jun 22, 2006 3:22 am

RE: vb2005 on read event not firing

Thu Jul 31, 2008 6:43 pm

I'm probably not the best one to try and help, since there are parts of your code that I'm not familiar with. But since no one else seems to be helping you...and I know how frustrating THAT is...

We do a lot of work with digital scales, interfacing with our app on a portble device, using the serial tools. Is that what this device is--a digital scale? Before interfacing it with my program, I always use some serial port software on my laptop to be sure I'm getting data and out of the scale. Have you already suceeded with this step? If not, I can point you to some good software for doing this testing.

But if you know that you are getting data in and out of the device through a laptop's serial port, then I can send you some code for how I used to use the .onread code in the past. Actually, I've recently changed over to the .read process because it was better in our case, but I still have some old .onread code if you think that might help.

The only thing I CAN'T help with is seeing what might be a problem in your code, because there is so much of your code that I'm not familiar with it. But let me know if you'd like any of the info I described above.

Return to “SerialTools”