David Walters
asked on
Buiilding a program to search a csv file by partnumber, then recover the info associated with that partnumber
I have a csv file with several partnumbers, descriptions, weight, cost, etc.. I have code to find a particular partnumber but can't figure out how to get the info that goes with that partnumber like cost, weight, etc. Here is the code so far:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FiletoSearch As String
FiletoSearch = c:\csvfiles\partnumbers.cs v
Dim Findstring = IO.File.ReadAllText(Fileto Search)
Dim wordSearch As String
wordSearch = TextBox1.Text
If Findstring.Contains(wordSe arch) Then
MsgBox("Found: " & wordSearch)
Else
MsgBox(wordSearch & " Not There")
End If
End Sub
Each partnumber, lets say 15133, has a string of data with it and the last value in the string is 15133.jpg. I want to capture all between the partnumber 15133 and the end of all its information at 15133.jpg. How is this done?
Thanks
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FiletoSearch As String
FiletoSearch = c:\csvfiles\partnumbers.cs
Dim Findstring = IO.File.ReadAllText(Fileto
Dim wordSearch As String
wordSearch = TextBox1.Text
If Findstring.Contains(wordSe
MsgBox("Found: " & wordSearch)
Else
MsgBox(wordSearch & " Not There")
End If
End Sub
Each partnumber, lets say 15133, has a string of data with it and the last value in the string is 15133.jpg. I want to capture all between the partnumber 15133 and the end of all its information at 15133.jpg. How is this done?
Thanks
ASKER
I'm missing something. Was wanting to put the found part number and its data in a textbox. Not using console. A windows form application.
That was a Windows Form application I posted note line 9 where the data is coming from.
Console.WriteLine(...) are being used here to test the data to the IDE Output put window. Please remove those lines of code and replace them with what you want to display them at.
Console.WriteLine(...) are being used here to test the data to the IDE Output put window. Please remove those lines of code and replace them with what you want to display them at.
ASKER
I'm sorry Mr Soto but I don't know how to replace them with what I want to display them at. I am new to Visual Studio 2013 from VB6. Was hoping to put the found partnumber and its information from its columns in a text string and the text string visible in a textbox.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There we go! Thanks for the code. Can take it from here. :)
Modified the code to get the results you want.
Open in new window