Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hyperterminal With
10-15-2014, 01:23 PM
Hyperterminal With
hii all i'm Making the project for weighbridge and stuck in how to perfect weight from hyperterminal.And also how to use Dos Printing.Any one plz help me..
my code is:-
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.CompilerServices
Imports Weighbridge.My
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Diagnostics
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.IO
Imports System.Reflection
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Windows.Forms
Imports System.IO.Ports

Public Class Main
    Dim abortThread As Boolean
    Public sFormat As String = "######"
    Dim myPort As Array  'COM Ports detected on the system will be stored here

    Private Sub WeighToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles WeighToolStripMenuItem.Click
        Weightment.MdiParent = Me
    End Sub

    Private Sub TransactionToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TransactionToolStripMenuItem.Click

    End Sub

    Private Sub Main_Disposed(sender As Object, e As System.EventArgs) Handles Me.Disposed
    End Sub

    Private Sub Main_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        If WeighPort.IsOpen Then
        End If
    End Sub

    Private Sub Main_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            WeighPort.PortName = "Com4"
            WeighPort.BaudRate = "4800"
            WeighPort.Parity = IO.Ports.Parity.None
            WeighPort.StopBits = IO.Ports.StopBits.Two
            WeighPort.DataBits = 8
            AddHandler WeighPort.DataReceived, AddressOf WeighPort_DataReceived
        Catch ex As Exception
        End Try
    End Sub
    Private Sub Read()
            If WeighPort.IsOpen Then
                Dim words As String = WeighPort.ReadExisting
                Dim split As String() = words.Split(New [Char]() {"="c, ","c, " "c, "-"c})
                For Each s As String In split
                    If s.Trim() <> "" Then
                        If s <> "" Or s <> vbNull Then
                            s = StrReverse(s)
                            s = Strings.Format(Conversions.ToDouble(s), Me.sFormat)
                            If Weight.Text <> s Then
                                Me.Weight.Text = s
                            End If
                        End If
                    End If
                Next s
            End If
        Catch ex As Exception

        End Try
    End Sub
    Private Sub WeighPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles WeighPort.DataReceived
            If WeighPort.IsOpen = True Then
            End If
        Catch ex As Exception

        End Try
    End Sub


Forum Jump:

User(s) browsing this thread:
1 Guest(s)

Return to TopReturn to Content