I have a vb project I am finishing and hope to sell to my industry, plastic molders and I am stuck on a few little things to make this a better user experence.
This question pertains to comboboxes that I have populated like this:
Private Sub IMM1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IMM1ToolStripMenuItem.Click
For Each s As String In System.IO.Directory.GetFiles("C:\QPILABS\Machines\")
That gets the entire file path in the combo box which I don't want but it worked really well with the streamreader:
Public Sub ToolStripComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged
Dim sr As New StreamReader((CType(ToolStripComboBox1.SelectedItem, String)))
Dim file As String
Dim lines() As String
' Reads machine data file to end
file = sr.ReadToEnd
' Closes machine data file
' File into its lines
lines = Split(file, vbCrLf)
' Clears memory
file = ""
' Popluates form1.vb IMM1 textboxes and checkboxes
If lines(9) = 0 Then textbox1.Text = lines(0)
If lines(9) = 1 Then TextBox86.Text = lines(0)
textbox2.Text = lines(1)
TextBox3.Text = lines(2)
But as I said I want only the file name so I found this method of popluating the combobox(s):
Public Sub IMM1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IMM1ToolStripMenuItem.Click, OpenToolStripMenuItem.Click
For Each s As String In System.IO.Directory.GetFiles("C:\QPI\Machines\")
Catch ex As Exception
MsgBox("There are no Machine files to load")
But that method does not give my streamreader a good file path to open and read so, how can I do this?
A little about me, total kludge hobby coder but I think I have done a fair job on this project. It builds and publishes fine, have several beta copies running with some friends in the business they report no issues with the app. They just want me to "clean it up" before I start to try to sell it. I don't plan to ever code another project, I will do the wire frames and watch someone else to the heavy lifting, this is not my gig so to speak.