First go around with programming in VB.net and came across a little issue. I'm trying to find a way to have an If statement control whether a for loop executes or not before going through another iteration.
Code:
For Each theTable In tableDoc.Tables
testString = ""
For row = 1 To theTable.Rows.Count
isHeaderOrNot = theTable.Cell(row, 1).Range.Text 'Gets value in first column
If isHeaderOrNot is Not Like "Section" or "Field" then Continue For 'if the words "Section" or "Field" are NOT included in isHeaderOrNot then continue with For loop
keyText = theTable.Cell(row, 2).Range.Text
valueText = theTable.Cell(row, 3).Range.Text
Console.WriteLine("KEY: {0}", keyText)
Console.WriteLine("VALUE: {0}", valueText)
Console.WriteLine("")
Next
Next
I'm getting an error on Like saying there's an expression expected..
Basically if the first column in the row the for loop is in contains Section or Field I want it go to the next line. First time trying to explain a question dealing with this, so any questions just ask! I truly appreciate your time!
Aucun commentaire:
Enregistrer un commentaire