August 2005 Archives

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

Myself

Projects

Monthly Archives

Photos

About this Archive

This page is an archive of entries from August 2005 listed from newest to oldest.

July 2005 is the previous archive.

September 2005 is the next archive.

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