Visual Studio Tab Management

By default, if you open a new file you get a new tab in your document window. After awhile, you can end up with forty two open tabs. To get things back under control, you have to use the Windows | Close All Documents choice, or right-mouse click on the one tab you want to keep open and select the Close All But This option).

If you want, you can have Visual Studio open any new document in your current window (provided that the current window has no unsaved changes). So, when you double-click on a file in Solution Explorer, the current window's content is replaced with the content of the file you just opened. You only get a new tab if the file in the current window has unsaved changes.

To turn this feature on, go into Tools | Options and in Environment | Documents check the "Reuse current document window, if saved" option.

Taking advantage of the feature does require a different mindset. When I use this feature, I start off by opening new tabs until I do a build or a debug (that saves all of my current changes). After that, when I open a new file, that new file replaces the file in the current tab. I find that I start searching my currently open tabs for "Which file do I want to get rid of?" I then select that file's tab and open a new file. It keeps the number of tabs under control, but it is a different way of working.

Do you have a Visual Studio tip, you'd like to share? Send it to me at [email protected].

Posted by Peter Vogel on 04/26/20110 comments


Comment Out Code, Quick

I never delete code -- you never know when you might want it back. So I spend a lot of time commenting out code. I do this so often, and mousing up to the menu takes so long, that I've memorized the keystroke combination for commenting/uncommenting code. It’s actually one of the few keystroke combinations -- other than Undo -- that I remember.

To comment a group of lines, first select the lines. Then, holding down the Control key throughout, press K, then C. To uncomment, hold down the Control key and press K, then U. (These two stroke combinations are called "chords.")

More

Posted by Peter Vogel on 04/19/201157 comments


Create New Classes from Server Explorer

You can get Visual Studio to create classes for managing (or, at least, observing) computer resources for you. In Server Explorer, under the Management Classes node, you'll find a list of "things you can manage." This includes desktop settings, processes/threads, and printers (!!), among other resource.

Find the item you want, right-mouse click on it, and select "Generate Management Class" to have Visual Studio generate a management class for you.

For instance, right-mouse clicking on My Computer in Server Explorer generates a class called ComputerSystem (in the namespace ROOT.CIMV2) with all sorts of read/write properties for changing settings on your application's host computer. It also includes many read-only properties for checking the computer's state. Several enumerations are included to allow you to write readable code.

There's another way to get Visual Studio to create a class for managing computer resources for you. If you work with Message Queues (or any of the other things listed in Server Explorer), Visual Studio is more than willing to generate a control that you can use from your code to manage that resource.

Just click on the item in Server Explorer and drag it onto a form (or any other design surface). Dragging a Message Queue from Server Explorer gives you a control dedicated to that queue with Receive and Send methods (and a ton of other methods and properties). You can do this with anything listed under the Services node or any of the categories listed under Event Logs.

You can use this feature in a class library, even though classes don't normally have a design surface. In Solution Explorer, right-mouse click on your project and select Add Component, instead of your normal Add Class. That will give you a "class with a design surface" that you can drag Server Explorer resources onto.

Don't go nuts! You can drag some but not all from Server Explorer -- see http://msdn.microsoft.com/en-us/library/84s2c1k0.aspx for a list of what you can and can not drag.

Do you have a Visual Studio tip, you'd like to share? Send it to me at [email protected].

Posted by Peter Vogel on 04/12/20110 comments


Eliminate Visual Studio Project Clutter

I'm constantly creating simple projects to test out some idea or as part of reviewing a new tool. By default, as soon as you create a new project, Visual Studio automatically saves the project file and, well, everything else. After awhile, I end up with 142 projects with dummy names ("TestTool", "TestTool1", "Experimental", "Experimental1", and so on).

You can turn off this behavior so that projects aren't saved until you tell Visual Studio you want them saved (you will be asked when you exit the project). Go to Tools | Options and under Projects and Solutions | General uncheck the "Save new projects when created" option.

This doesn't work for all project types (it has no effect on ASP.NET or Silverlight projects, among others, for instance). Fortunately, it's easy to tell whether it works on the project you're creating: You won't have the Location textbox at the bottom of the New Project dialog. Don't Panic! You'll get a chance to save your stuff when you leave the project. Or, if you've done everything you need to do with the project, to not save your stuff later.

For any project that you do want to keep, though, it would be a good idea to do a Save soon after starting the project. If you don't do a save and Visual Studio crashes, you may not be able to recover your project.

Do you have a Visual Studio tip, you'd like to share? Send it to me at [email protected].

Posted by Peter Vogel on 04/05/20110 comments


SharePoint GUID Collision Avoidance

SharePoint developers working in Visual Studio 2010 know that GUID collisions can be a needless nuisance. Brian Watts sent along this tip that he got from one of Doug Ware's tutorials on SharePoint . Brian adds a pre-deployment command to his Visual Studio build-deploy-debug process that deletes and recreates his SharePoint site before he does any testing. Brian says he can't remember the last time he had a problem with a GUID clash. More

Posted by Peter Vogel on 03/29/20110 comments


Tool Windows, Begone

While all of the tool windows in Visual Studio (Solution Explorer, Properties, Debug) are wonderfully useful, the main editor/document window where your code lives is the one that matters.

You can instantly give yourself a document window that completely fills Visual Studio by selecting Auto Hide All from the Windows menu. This causes every (every!) tool window to turn into little labels hugging the borders of Visual Studio and popping out only when you want them (or when Visual Studio thinks you should want them). If you can't find Auto Hide All, it's because you've already closed or hidden your tool windows.

More

Posted by Peter Vogel on 03/22/20118 comments


Welcome to .NET Tips and Tricks

We're changing up our coverage on the Visual Studio Magazine Web site. Yes, I'll continue to review development tools in each issue of VSM, but the focus of this blog is shifting. Rather than look at the third-party tools industry, I'll focus on making you more productive with the tools you use every day: Visual Studio and .NET Framework.

Starting this week, I'll be publishing useful tips and tricks that can make you more productive. That includes (but isn't limited to) getting more out of Visual Studio. There is a ton of useful stuff in the IDE that I don't think anyone outside of the Visual Studio development team knows about. The same is true of .NET as a whole. There are features in the .NET Framework that are waiting for you... if you only knew about them.

More

Posted by Peter Vogel on 03/21/20110 comments


What's in a Slogan

If you saw my earlier post on cool slogans from software companies , you know that the slogan from ComponentOne is "Less Coding, More Business Logic". I like that philosophy (though personally I'd have gone with "Less grunt work, more functionality"). Still, I think More

Posted by Peter Vogel on 03/03/20111 comments


March Issue Preview: ComponentOne and Telerik TeamPulse

In March, we're going to round out our reviews of major product vendor suites by looking at ComponentOne's Studio for ASP.NET AJAX. It's a good time to take a look because ComponentOne has got a new release coming out.

Well, actually, they've got a new release of their Studio Enterprise coming out: Every suite for every platform in .NET (and ActiveX, too). It's hard enough to review the component suites without reviewing suites in seven different technologies, at least some of which I'm not competent to comment on except as a beginner (e.g. Studio for Compact Framework). How to decide which suite to review?

It's not quite as arbitrary as rolling a seven-sided die (not that I own such a thing) but it's close. Fundamentally, I look at which audiences we've served recently and pick the audience that we've ignored the longest (and I also factor in the relative size of those audiences). So, if you're wondering why we're looking at the ASP.NET AJAX package, that's why.

In some ways that's too bad: ComponentOne has a new ReportViewer that they're obviously very proud of. I'll be looking at the ASP.NET version, but the press release from ComponentOne talks up the Silverlight version. I don't think it's likely that we'll have a chance to cycle back around to it -- so much software, so little time.

We'll also be looking at Telerik's TeamPulse -- an application lifecycle management tool. We've looked at other ALM tools, such as DynaTrace, Ants Performance Profiler and Sybase PowerDesigner, but it's been awhile since we've visited this topic.

The previous products performed very specific application management tasks, but TeamPulse is operating at a higher level: it's designed to "capture ideas and requirements,... and analyze project state." That's a big job. While I will look at the big picture, I'm going to be interested in how TeamPulse supports the individual developer. Does the product make life easier or harder for the programmer trying to generate code?

Posted by Peter Vogel on 02/18/20110 comments


Free Tools: Data Debugger Visualizer for VS 2005/2008

If you use DataSets and are tired of figuring out what's in your DataSet by asking for Counts of the Rows collection and entering ds.Tables(0).Rows(0)("CustomerId") in the Immediate window, then you need Dan Green's Data Debugger Visualizer. When stepping through your code, you hover your mouse over a DataSet (or DataTable or DataRow) variable and the DataVisualizer's commandbar pops up.

I use DataSets a lot and the Visualizer has saved me endless time in diagnosing problems. The tabbed dialog lets me switch between the schema for the table and a view that shows the data in the rows. I get the row count for any table I choose and can switch between seeing "live" rows or deleted rows. The Row Filter lets me set criteria to limit the rows (useful in large DataSets). For any row, I can quickly see its state (unchanged, deleted, etc.) and, for any field, its original and current values (and any cell errors).

The tool can be downloaded from CodePlex as a Visual Studio 2005 project. Open it, build it, and the appropriate DLL is created and dropped into the right Visual Studio folder. After that, you'll find it waiting for you when you right-mouse click on a DataSet reference. While the tool is free, the author welcomes contributions.

This isn't the only DataSet visualizer out there (you might, for instance, want to check out RightHand's visualizer). Visual Studio 2010 comes with its own DataSet Visualizer, which I'm getting used to, but for old times' sake I recompiled Dan Green's tool into Visual Studio 2010. I had to update the reference to Microsoft.VisualStudio.DebuggerVisualizers. But other than that, the tool worked just like always.

Posted by Peter Vogel on 02/14/20111 comments


Talking with Infragistics About Data Visualization

We recently reviewed Infragistics' "data visualization" bundle, concentrating on the Silverlight package ( Visualizing BI with Infragistics NetAdvantage for Silverlight Data Visualization ). Since I consider myself a "business/database developer", the idea of a class of applications called Data Visualization was -- to the say the least -- intriguing. Fortunately, Megan Sheehan, senior product manager of Data Visualization at Infragistics, was able to take the time to talk about the product line. More

Posted by Peter Vogel on 02/10/20110 comments


Q&A with Julian Bucknall Part 2

Julian M. Bucknall, CTO at DevExpress continues our discussion on the Visual Studio/.NET toolspace, this time looking at DevExpress' users and process for extending the package.

Peter Vogel: Are there differences between creating a suite for ASP.NET developers and other developer groups (e.g. WinForms/Silverlight/WPF/whatever)? I.e. what do these target markets share and where (if anywhere) do they look different?

More

Posted by Peter Vogel on 02/03/20110 comments


Subscribe on YouTube