WHERE INSTRUCTIONS
Place the cursor at the first line of the code. Double-click. A new window opens. Press the F5 key to run the code. When you click OK, the code begins to run.
EXPLANATION
The WHERE command enables you to limit the range of lines in a file to the results of a particular expression. The expression that you enter appears in quotes, just as it would appear in a command. For example, to list the first 10 lines that start with a character string, use this syntax: WHERE SomeString.
The following code is a WHERE command that lists only the first 10 lines that start with an uppercase letter.
0) WHERE SomeString.
1) For i = 1 To 10.
2) MsgBox i
3) Next i
It is also possible to specify that the expression in the WHERE command should be evaluated in an absolute manner. For example, in this syntax, the expression is evaluated with respect to the entire file.
2) For i = 1 To 10.
3) MsgBox i
4) Next i
Examining the result of the WHERE command in the Immediate window shows you that the result includes only the first 10 lines in the file.
2>0) Where SomeString.
1>1) For i = 1 To 10.
2>2) MsgBox i
3>3) Next i
4>4) Next
The WHERE command in VB.NET is similar to its counterpart in Visual Basic 6.0.
A:
For the benefit of those arriving here after Google searching for an answer, I'll summarise the answer in this question.
As the accepted answer noted, the syntax for a where clause in Visual Basic is different from the corresponding one in VB6. Here's a quote from the MSDN:
Note: Visual Basic and Visual C# have different syntax for the WHERE
clause. In Visual Basic you must use the clause: WHERE TableName.[field]
= [value].[Parameter].[Expression]. In Visual C# you must use the
clause: WHERE TableName.[field] = [value].[Parameter].[Expression].
Here's
Related links:
Commentaires