Archives for August 2010

#83 Search from the command line

Did you know Visual Studio has a Command mode? This isn’t cmd.exe – but it’s virutally the same concept, inside of visual studio. This command window will let you type commands for virtually any command in Visual Studio. This video will show you how to search from the Command Line.

Additional Command Line options:
Edit.Find /options – Shows which options are currently set
Edit.Find /reset – clears all options

Some examples:
Edit.Find MainForm /case / proc (Quick Find, match case, in current procedure – )
Edit.Find MainForm /o /m /u /h /l (Quick Find, open documents, match whole word, mark matches, search up, search hidden)
Edit.Replace /doc /all (Quick Replace, replace all, current document)
Edit.FindInFiles btnCancel /lookin:"c:\users\saraf\documents\visual studio 2008\projects\vb samples" /ext:*.vb /text2 (Find In Files, look in the VB Samples folder with files of .vb extension, and show results in Find Results 2 Window) 

#82 Show and hide find messages

Ever dismiss a dialog, and then want to get it back again? Far too often, we uncheck the "Show this message again" checkbox not knowing how to get the message back. For Find and Replace, you can specify whether to hide or show these message boxes at Tools – Options – Environment – Find and Replace, options Display informational messages and Display warning messages.

Informational messages are those "FYI – For your information" style messages.  Examples include "no more occurrences found," "the specified text was not found," "Find reached the starting point," and so forth. Warning messages are those that ask a question along the lines of "are you sure?"  For example, "Do you want to cancel?", "Do you want to open files when you do a find in replace in closed files to enable undo," and so forth.

#81 Replace in all files (With Undo Support)

Global search/replace can be tricky. Often times you’ll end up replacing something that you didn’t realize was going to be replaced. Having an undo feature is vey helpful. This video shows you the ins and outs, of Find/Replace in all files.

Just like Ctrl+H does a Quick Replace, Ctrl+Shift+H will bring up the Replace in Files window.  We’ve seen all these options over the past 2 weeks, but there’s just one more now that has become enabled.

“Keep modified files open after Replace All”

Obviously, if you check this option, all modified files will be opened in the editor.  The significance of this is that you can do an undo, if you change your mind. If you don’t have this option checked, we’ll prompt you "are you sure you don’t want to do an undo?" After you commit the Replace all with the files opened, if you decide to do an undo, just simply press Ctrl+Z on one of the newly modified / opened files.  You’ll notice that all open files will have the dirty bit * removed, reverting to their previous contents.