i need to develop a software in which i can connect to a handpunch1000 throug vb.net and collect data , i am using visual studio 2010 any help ?

Recommended Answers

All 7 Replies

add a serialport to your form select your handpuch port

ComboBox1.Items.AddRange(IO.Ports.SerialPort.GetPortNames)
SerialPort1.PortName = ComboBox1.SelectedItem.ToString

open it

SerialPort1.Open()

Receive data and convert

Private Sub DataReceived(ByVal sender As Object, _
                      ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
                      Handles SerialPort1.DataReceived
        If SerialPort1.BytesToRead > 0 Then
        SerialPort1.Read(your data)
        end if
        'convert bytes to plain text
        System.Text.Encoding.ASCII.GetString(your data)

good luck

what you mean by your data , can you give me an example ? if i want to collect a txt file from the handpunch , one more thing the hand punch is connected ethernet throug a converter from serial to network

your data: the data received from handpunch

        If SerialPort1.BytesToRead > 0 Then
            Dim buff(SerialPort1.BytesToRead - 1) As Byte
            SerialPort1.Read(buff, 0, buff.Length)
            Me.BeginInvoke(New myDelegate(AddressOf SerialPortDelegate), buff)
        End If

  Public Delegate Sub myDelegate(ByVal buff() As Byte)


   RichTextBox1.Text = System.Text.Encoding.ASCII.GetString(buff, 0, buff.Length)
            RichTextBox1.SaveFile("your path\filename.txt", RichTextBoxStreamType.PlainText)

dunno oussama run this code i am confused a little , my handpunch is connected to a converter that have an ip ( 192.168.1.14) , i want to collect the data from my hand punct throug network

oh! ok try this

 Dim handpunchdata As String = New System.Net.WebClient().DownloadString(ip)

if that doesn't work i need to see a sample of your data (i mean is it a binary or hex...)

you remmenber the txt file i showed you for the import issue ? this txt file exported through a software that can connect to the handpunch , but i am trying to develop a similar software in vb

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.