Question: Hi i need help! I have a data windows form application that takes information from files and only Prints info to a datagridview if a
Hi i need help! I have a data windows form application that takes information from files and only Prints info to a datagridview if a a file has a specific title. On the data gridview i am having trouble adding values to one of the columns. I am trying to grab a specific column/row value from a row that say holds a NG value .
I have included a picture. In the picture whenever NG is in the Judge column i want to get the string value of the the cell on the same row in The Test No column to put in my datagridview.

using (FileStream stream = File.Open(x, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (StreamReader reader = new StreamReader(stream)) {
string partNum = ""; string tester = ""; string testNo = ""; string date = ""; string time = ""; string serialNum = "";
while (!reader.EndOfStream) {
try {
var line = reader.ReadLine(); if (line.Split(',')[0].Equals("Assy No.")) { partNum = line.Split(',')[1];
} if (line.Split(',')[0].Equals("TesterName")) { tester = line.Split(',')[1]; } if (line.Split(',')[0].Equals("Date")) { date = line.Split(',')[1];
} if (line.Split(',')[2].Equals("Time")) { time = line.Split(',')[3]; }
if (line.Split(',')[2].Equals("Serial")) { serialNum = line.Split(',')[3];
}
if (line.Split(',')[3].Equals("Test No.")) { } if (line.Split(',')[14].Equals("NG")) {
DataRow allShiftRow = Construct.MainDataTable.NewRow(); allShiftRow["Part Number"] = partNum; allShiftRow["TesterName"] = tester; allShiftRow["Date"] = date; allShiftRow["Time"] = time; allShiftRow["Test No."] = testNo;
// allShiftRow["Result"] = line.Split(',')[8]; allShiftRow["SerialNum"] = serialNum; Construct.MainDataTable.Rows.Add(allShiftRow);
Construct.totalInvalidTest++;
}
} catch {
} } } }
application thus far

Serial Time Judge Con Disc Dis Dis P01 P01 P01 01 Unit Seq No. Measure?Upper Lim Upper Lim Lower Lim Lower Lim Data Se Chec Test No. up No. Step No. 0 B001 0 C001 0 A003 0 B003 0 C003 0 D003 0 E003 0 F003 0 A005 0 B005 0 OK 0 OK 0 OK 0 1.7186 ohm 0 1.9028 ohm 0 1.8044 ohm 0 1.922 ohm OK 10 10 10 10 OK 1O P 1O P 1 O P NG 1O P 3 O N 3 O N 0 10 10 10 0 2.0408 ohm 0 1.8063 ohm 0 1.8764 ohm N01 N01 OK 2 OK
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
