Switching between header and impl files in .NET (cont)

| No Comments | No TrackBacks
In a previous post I wrote about switching between header and impl files in .NET, and I referred you to a codeproject page with some VB script that does the switching. The code on codeproject assumes that the files reside in the same directory, which isn't always the case. Here's some slightly improved code.. It fits my needs anyways.. :)

Option Strict Off
Option Explicit Off

Imports EnvDTE
Imports Microsoft.VisualBasic

Public Module Switch

Sub Switch()
Dim a As String
Dim b As String
Dim Flag As Integer
Flag = 0
a = DTE.ActiveDocument.Name()
tmp = InStr(a, ".cpp")
If tmp Then
b = Left(a, Len(a) - 3) + "h"
Flag = 1
Else

tmp = InStr(a, ".hh")
If tmp Then
b = Left(a, Len(a) - 2) + "cc"
Flag = 1
Else

tmp = InStr(a, ".cc")
If tmp Then
b = Left(a, Len(a) - 2) + "hh"
Flag = 1
Else
tmp = InStr(a, ".h")
If tmp Then
b = Left(a, Len(a) - 1) + "cpp"
Flag = 1
End If
End If

End If
End If


If Flag Then
DTE.Solution.FindProjectItem(b).Open()
End If
End Sub
End Module

No TrackBacks

TrackBack URL:

Leave a comment

Myself

Projects

Monthly Archives

Photos

About this Entry

This page contains a single entry by Robert W. Rose published on August 17, 2005 10:15 AM.

Hiragana tester was the previous entry in this blog.

Hurricane Katrina is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.