I wish there was... one like the Ctrl+] shortcut in C# which allows
you to move between matching braces.
However, I found a macro some time back that I use personally. Feel
free to use it for your own convenience.
---
Public Module Kbd
Private Function CleanLine(ByVal sLine As String) As String
sLine = sLine.ToUpper
sLine = sLine.Replace(vbTab, "")
sLine = sLine.Trim()
Return sLine
End Function
Sub FindBrace()
Dim bFoward As Boolean
Dim bIfCount As Integer = 1
Dim o As TextSelection = DTE.ActiveDocument.Selection
Dim sLine As String
o.DTE.SuppressUI = True
o.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
o.SelectLine()
sLine = CleanLine(o.Text)
Select Case True
Case sLine.StartsWith("IF ")
bFoward = True
Case sLine.StartsWith("END IF")
Case Else
Exit Sub
End Select
Do
If bFoward Then
o.LineDown(False, 0)
Else
o.LineUp(False, 1)
End If
o.SelectLine()
sLine = CleanLine(o.Text)
Select Case True
Case sLine.StartsWith("IF ")
If bFoward Then
bIfCount += 1
Else
bIfCount -= 1
End If
Case sLine.StartsWith("END IF")
If bFoward Then
bIfCount -= 1
Else
bIfCount += 1
End If
End Select
Loop Until bIfCount = 0
o.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
o.LineUp(False, 1)
o.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
End Sub
End Module
---
On Mar 20, 12:33 am, jtaylor <[email protected]> wrote:
> In VB.NET (VS 2005), is there any way to jump from the beginning to
> the end (or vice versa) of a code block? For example, put your cursor
> on an If and jump to the Endif.