Hi,

I have writen web sites before but have been asked to create a VB program, but dont know where to start so hoping someone can help me.

I need to create a program that sits waiting for data from the serial port which is attached to a set of scales, when the scales are triggered they send the weight of the object down the serial port to the pc that then writes the data to a text file and then waits for the next weight to be received, and continuous to run until stopped at the end of the day.

I hope someone can help.

Regards

Matthew

Recommended Answers

All 5 Replies

Maybe this example will get you on the way. Success. :)

Thank you am i write in thinking this write the data to screen? do you know how would i append to a text file instead

regards

matthew

If you need to append to a text file, there are many examples on the web of how to do it. Search the following using your favorite search engine: vb.net append to text file

ddanbe, sorry to be a pain but i am complete novice to this, the code you linked in should this be run from a console app or not where should the text be output to do i need to define anything. HELP

this might help

I have the code below, where would i place the code that reads data from serial port

Imports System
Imports System.IO.Ports

Public Class Form1

Private mySerialPort As New SerialPort

Private Sub ButtonShowPorts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonShowPortsol.Click
    ' Show all available COM ports. 
    For Each sp As String In My.Computer.Ports.SerialPortNames
        ListBox1.Items.Add(sp)
    Next
End Sub

Private Sub ButtonClearList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClearList.Click
    ListBox1.Items.Clear()
End Sub

Private Sub ButtonClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonClose.Click
    Close()
End Sub

Private Sub ButtonRunLogger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRunLogger.Click

End Sub

Private Sub ButtonStopLogger_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStopLogger.Click

End Sub

End Class

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.