I am trying to make a program I am writing (C# in Visual Studio) look up a value in an external CSV file, and pull the value in the next column back in to a label in my WinForm.
My CSV file, which is a test with dummy data, is:
> old,newuser,newpassword
> firstlinetomakesure,firstnewusername,firstnewpassword
> adslusernameplaintext,thisisthenewuser,andthisisthenewpassword
> hello,terion,nadiomn
> somethingdownhere,thisisthelastuser,andthisisthelastpassword
> 11,12,13
> 21,22,23
> 31,32,33
I have tried using the solution at the link below, but could only return the value in the second column of the last line.
Search value in csv file using c#
I've been trying to make the program search the "old" column for a value, then pull in the value from the "newuser" column on the matching row. This would then go onto a label in the WinForm.
Any example code or suggestions would be appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…