Hi,
I am trying to find a way to upload only the first line of a .csv to TextBox1 as input and push that first line of values to TextBox2 on each own line (please see last image).
I'm trying to write this in Button1.
I'm a bit lost and some advice would be great at this point.
I have this code I'm working with:
This is the form design:
![Name: form.PNG
Views: 38
Size: 9.9 KB]()
Eventually I would like to have the Next and Previous (Not showing yet) buttons to read this process line by line in the .csv, but I'm learning and I'm looking at doing one step at a time.
The input and output is simply for testing purposes to tell me stuff is being written properly. Eventually I will want to remove these boxes and trust the process to be written and sent from memory, activated by left and right arrow keys instead of Next and Back buttons.
Thanks in advance for any help I get from anyone!
Scott
example of the form after I write comma separated values manually into it:
![Name: form2.PNG
Views: 32
Size: 44.8 KB]()
I am trying to find a way to upload only the first line of a .csv to TextBox1 as input and push that first line of values to TextBox2 on each own line (please see last image).
I'm trying to write this in Button1.
I'm a bit lost and some advice would be great at this point.
I have this code I'm working with:
Code:
Imports System
Imports System.Threading
Imports System.IO.Ports
Imports System.ComponentModel
Public Class Form1
Dim myPort As Array
Delegate Sub SetTextCallBack(ByVal [text] As String)
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
myPort = IO.Ports.SerialPort.GetPortNames()
portComboBox.Items.AddRange(myPort)
writeButton.Enabled = False
End Sub
Private Sub initButton_Click(sender As System.Object, e As System.EventArgs) Handles initButton.Click
SerialPort1.PortName = portComboBox.Text
SerialPort1.BaudRate = baudComboBox.Text
SerialPort1.Open()
initButton.Enabled = False
writeButton.Enabled = True
closeButton.Enabled = True
End Sub
Private Sub writeButton_Click(sender As System.Object, e As System.EventArgs) Handles writeButton.Click
Dim input As String = inputTextBox.Text
Dim colString As String = String.Join(Environment.NewLine, input.Split(","c))
SerialPort1.WriteLine(colString)
inputTextBox.Clear()
inputTextBox.Select()
End Sub
Private Sub closeButton_Click(sender As System.Object, e As System.EventArgs) Handles closeButton.Click
SerialPort1.Close()
initButton.Enabled = True
writeButton.Enabled = False
closeButton.Enabled = False
End Sub
Private Sub SerialPort1_DataReceived(sender As System.Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting())
End Sub
Private Sub ReceivedText(ByVal [callBackText] As String)
If Me.outputTextBox.InvokeRequired Then
Dim callBack As New SetTextCallBack(AddressOf ReceivedText)
Me.Invoke(callBack, New Object() {(callBackText)})
Else
Me.outputTextBox.Text &= [callBackText]
End If
End Sub
End ClassEventually I would like to have the Next and Previous (Not showing yet) buttons to read this process line by line in the .csv, but I'm learning and I'm looking at doing one step at a time.
The input and output is simply for testing purposes to tell me stuff is being written properly. Eventually I will want to remove these boxes and trust the process to be written and sent from memory, activated by left and right arrow keys instead of Next and Back buttons.
Thanks in advance for any help I get from anyone!
Scott
example of the form after I write comma separated values manually into it: