Hi,
I had a longer break, but now I want to continue working on my little project to make my work easier.
I have an Excel file which I converted to CSV because there is no Excel on the target system.
I would like to search for a number or word via vb.net. This word can appear in all columns! If the word was found, then
the cell in column A, B, D, AA and AB is to be output in the respective labels from this line. (lbl_Cell_A, lbl_Cell_B, lbl_Cell_D, lbl_Cell_AA, lbl_Cell_AB)
Unfortunately I only know how to search in the first column (A) and only output columns one after the other.
Here is my code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
For Each row As String In File.ReadAllLines("Test.csv")
' split the fields from the row '
Dim vFields() As String = Split(row, ";")
If vFields(0).Contains(TextBox1.Text) Then
lbl_Cell_B.Text = vFields(1)
lbl_Cell_C.Text = vFields(2)
End If
Next
Catch ex As Exception
MessageBox.Show("Error : " & ex.Message)
End Try
End Sub
Can you help me, please?