Dustin Campbell Program Manager Microsoft DTL321.

24

Transcript of Dustin Campbell Program Manager Microsoft DTL321.

Page 1: Dustin Campbell Program Manager Microsoft DTL321.
Page 2: Dustin Campbell Program Manager Microsoft DTL321.

Microsoft Visual Basic IDE Tips and Tricks

Dustin CampbellProgram ManagerMicrosoftDTL321

Page 3: Dustin Campbell Program Manager Microsoft DTL321.

Announcing CodeRush Xpress!

FREE add-in for Visual Studio 2008CodeRush Xpress (for C#) + Refactor! (for VB)Support for both C# and Visual BasicSeveral key productivity features:

50+ RefactoringsDuplicate Line Generate from Using (TDD) Highlight All References Increase/Reduce Selection Smart Clipboard Operations Quick Symbol NavigationQuick File Navigation

Page 4: Dustin Campbell Program Manager Microsoft DTL321.

Refactorings…Add Block DelimitersAdd Parameter Combine ConditionalsCompress to Lambda Expression Compress to Ternary Expression Convert to Auto Property Convert to InitializerCreate Backing Store Create OverloadCreate With Statement Decompose Initializer Decompose Parameter Encapsulate Field Encapsulate Field (read only) Expand Lambda Expression Expand Ternary ExpressionExtract Interface Extract Method Extract PropertyExtract XML Literal to Resource

Flatten Conditional Inline Delegate Introduce ConstantIntroduce Constant (local) Introduce Local Introduce Local (replace all) Inline Temp Inline With Statement Make Explicit Make Implicit Method to Property Move Declaration Near Reference Move Initialization To Declaration Move Type to File Name Anonymous Method Name Anonymous Type Property to Method(s) Remove Assignments to ParameterReorder Parameters Remove Unused Parameter

Replace Temp with Query Reverse Conditional Simplify Expression Split Conditional Split Initialization from DeclarationSplit Temporary VariableUse String.Format Use StringBuilderWiden Scope Widen Scope (promote constant) Widen Scope (promote to field)

Page 5: Dustin Campbell Program Manager Microsoft DTL321.

Agenda

Setting Up Visual StudioWriting CodeUnderstanding and Navigating CodeUsing CodeRush Xpress

[05] Visual Studio 2005[08] Visual Studio 2008[10] Visual Studio 2010[+] Third-party add-in[CRX] CodeRush Xpress

Page 6: Dustin Campbell Program Manager Microsoft DTL321.

Setting Up Visual Studiodemo

Page 7: Dustin Campbell Program Manager Microsoft DTL321.

Setting Up Visual Studio

Visual Basic Development SettingsStreamlines IDE experienceQuick access to commonly used featuresKeyboard shortcuts use VB6 as a baseline

Tweaks That I Like to Make [05]Environment | Keyboard options page

Remove F2 binding for View.ObjectBrowserBind F2 to EditorContextMenus.CodeWindow.Rename in the Text Editor contextRebind Edit.Redo to Ctrl+Y

Page 8: Dustin Campbell Program Manager Microsoft DTL321.

Setting Up Visual Studio

Tweaks That I Like to Make (Continued) [05]Projects and Solutions | General options page

Check “show advanced build configurations”Leave “always show solution” uncheckedLeave “save new projects when created” unchecked

Projects and Solutions | VB Defaults options pageSet Option Strict to “on”

Export your settings to use them again later!

Page 9: Dustin Campbell Program Manager Microsoft DTL321.

Writing Codedemo

Page 10: Dustin Campbell Program Manager Microsoft DTL321.

Writing Code

IntelliSense in VS 2008[08] Keyword IntelliSense[08] IntelliSense Everywhere (new lines, expressions, etc.)[08] Prefix filtering

IntelliSense in VS 2010[10] Substring and camelCase filtering[10] Consume-First Mode (Ctrl+Alt+Space)

Page 11: Dustin Campbell Program Manager Microsoft DTL321.

Writing CodeCode Snippets

[05] ?<TAB> to display snippet UI[08] Expansion snippets (double-tab)[08] Hide/show snippet fields[+] Free Snippet Editor available at http://codeplex.com/SnippetEditor

Error Corrections (Ctrl+.)[08] Add Imports Error Correction[10] Generate from Usage

Generate from UsagePerfect for a “consume-first” style of developmentGenerate field, method, property, type and constructor

Page 12: Dustin Campbell Program Manager Microsoft DTL321.

Understanding and Navigating Codedemo

Page 13: Dustin Campbell Program Manager Microsoft DTL321.

Understanding and Navigating Code[10] Type colorization[10] Method separator line[10] Highlight references(Ctrl + Shift + Up, Ctrl + Shift + Down)

Color!

Page 14: Dustin Campbell Program Manager Microsoft DTL321.

Understanding and Navigating Code

[CRX] Quick NavigationSymbols (Ctrl + Shift + Q)Files (Ctrl + Alt + F)Preview results (Ctrl)

[CRX] Structural Highlighting

Page 15: Dustin Campbell Program Manager Microsoft DTL321.

Understanding and Navigating Code

[10] Navigate To (Ctrl + ,)Find files, types and members in a solutionSupports VB, C# and C++ out of the boxAllows multiple search terms, substring and camelCase matches

[05] Next and Previous Method(Ctrl + Down, Ctrl + Up)[+] Source Code Outliner

Helps visualize structure of the active filehttp://sourcecodeoutliner.codeplex.com/

Page 16: Dustin Campbell Program Manager Microsoft DTL321.

Understanding and Navigating Code

[10] Outlining RefreshPreview a region by hovering over the marginDouble-click the margin to collapse

[10] “Adhoc” OutliningSelect a block of code and collapse itTo add region: Ctrl + M, Ctrl + HTo remove region: Ctrl + M, Ctrl + UPersisted in the solution options file (*.suo)

Page 17: Dustin Campbell Program Manager Microsoft DTL321.

Using CodeRush Xpressdemo

Page 18: Dustin Campbell Program Manager Microsoft DTL321.

Using CodeRush Xpress

CodeRush Refactor! key (Ctrl+`)CamelCase Navigation (Alt + Left, Alt + Right)Tab to Next Reference (Tab)http://devexpress.com/crx

Page 19: Dustin Campbell Program Manager Microsoft DTL321.

question & answer

Page 20: Dustin Campbell Program Manager Microsoft DTL321.

Visual Basic ResourcesVisual Basic Developer Centerhttp://msdn.com/vbasic

Blogshttp://blogs.msdn.com/vbteam (VB Team)http://blogs.msdn.com/bethmassi (Beth Massi)

CodeRush Xpresshttp://devexpress.com/crx

Visual Basic Forumshttp://social.msdn.microsoft.com/forums/en-us/category/visualbasic

Connecthttps://connect.microsoft.com/VisualStudio

Page 21: Dustin Campbell Program Manager Microsoft DTL321.

www.microsoft.com/teched

Sessions On-Demand & Community

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learningMicrosoft Certification and Training Resources

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources

Page 22: Dustin Campbell Program Manager Microsoft DTL321.

Track Resources

Visit the DPR TLC for a chance to win a copy of Visual Studio Team Suite. Daily drawing occurs every day in the TLC at 4:15pm. Stop by for a raffle ticket

http://www.microsoft.com/visualstudio

http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx

Please visit us in the TLC blue area

Page 23: Dustin Campbell Program Manager Microsoft DTL321.

Complete an evaluation on CommNet and enter to win!

Page 24: Dustin Campbell Program Manager Microsoft DTL321.

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.