VS 2012: Scroll Solution Explorer to current file - file

VS2010 had the feature that viewing a file would automatically cause Solution Explorer to scroll to that file.
With VS2012, viewing different files from within the IDE no longer scrolls and select the file in Solution Explorer automatically.
Is it possible to get this feature back? Is there a setting somewhere? If so, how/where?

Yes, you can find that under
Tools - > Options - > Projects and Solutions - > Track Active Item in Solution Explorer
It's off by default (as you've noticed), but once it's on, Solution Explorer will expand folders and highlight the current document as you switch between files.

If you need one-off sync with the solution pane, then there is new command "Sync with Active Document" (default shortcut: Ctrl+[, S). Explained here: Visual Studio 2012 New Features: Solution Explorer

If you have ReSharper installed clicking Shift+Alt+L will move focus to the current file in Solution Explorer.
Active Item Tracking will also need to be enabled as described in the accepted answer
Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer

There are many ways to do this:
Go to current File once:
Visual Studio 2013
VS 13 has it's own shortcut to do this: Ctrl+\, S (Press Ctrl + \, Release both keys, Press the S key)
You can edit this default shortcut, if you are searching for SolutionExplorer.SyncWithActiveDocument in your Keyboard Settings (Tools->Options->Enviornment->Keyboard)
In addition there is also a new icon in the Solution Explorer, more about this here.
Visual Studio 2012
If you use VS 2012, there is a great plugin to add this new functionality from VS2013 to VS2012: . The default shortcut is strg + alt + ü. I think this one is the best, as navigating to the solution explorer is mapped to strg + ü.
Resharper
If you use Resharper try Shift+Alt+L
This is a nice mapping as you can use Strg+Alt+L for navigating to the solution explorer
Track current file all the time:
Visual Studio >= 2012:
If you like to track your current file in the solution explorer all the time, you can use the solution from the accepted answer (Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer), but I think this can get very annoying in large projects.

If you don't have ReSharper installed and still want to use the shortcut Shift+Alt+L to move focus to the current file in Solution Explorer in Visual Studio 2013 then please follow these steps:
Go to Tools->Options and search for "Keyboard" in the Search Options textbox:
In the Show commands containing box type "solutionexplorer" and then in the list below look for the SyncWithActiveDocument command:
Click in textbox under "Press short keys" label and press: Shift+Alt+L and click the Assign button and you are done:
To verify open any file in Visual Studio and press the shortcut keys Shift+Alt+L and you'll see the file in the solution explorer. Enjoy!

It is possible in VSS by three ways.
You can click on Active sync icon on Solution Explorer.
By selecting Active sync checkbox in Tools (Tools > Options > Projects and Solutions > General). In that check the Track Active Item in Solution Explorer Checkbox. When you select a file in the main window, it will automatically navigate to active file in the Explorer.
By using the Shortcut key (Ctrl + [ + S), you can able to navigate to active Item.
Note: Either 1 or 2 only works in a mean time.. So You have to use either 1st or 2nd.

I've found the Sync with Active Document button in the solution explorer to be the the most effective (this may be a vs2013 feature!)

On Visual Studio 2017, the shortcut is: Ctrl+´,S.

Visual Studio 2019
Tools => Options

Related

How to show project explorer pane on right side of screen

I recently switched to Wing Pro from Visual Studio. Today my Wing IDE opened without the project explorer pane on the right side showing -- it's called project explorer in Visual Studio, I think it's called the same in Wing. It's the listing of all project files.
I have looked all over the documentation and options but I haven't found where to make it show again.
Thanks for any help.
If no tools at all are showing, you have have pressed Shift-F2 (Maximize Editort Area) and can press that again to re-show them. Or, just choose Project from the Tools menu and it should show the tool regardless of what display mode you're in.

Object reference exception when drag and dropping from toolbox to Windows Forms designer

When dragging a control from the toolbox and dropping it in the Windows Forms designer, a message box appears with the message Object reference not set to an instance of an object.
After closing the message box, I can drop the control on the form without any other issue.
This happens on a new project as well. The error appears in both VS 2015 and 2017 (both community editions).
EDIT : This happens on any control, including custom ones. This started happening after I updated to the latest version of Windows 10 (17134.48).
Instead of dragging and dropping, Clicking on the control, then clicking on the form is the workaround working for me until they come out with a newer update.
This is new behavior as of Visual Studio 2017 Version 15.8.6 for me.
Hopefully this will help others that just kept dragging and dropping over and over like I was doing :-)
Experiencing the same issue on Microsoft Visual Studio Community 2019 Version 16.5.0. I found that I was not able to drag and drop controls while VS was open on my high DPI external monitor, but if I moved VS to my native laptop monitor, I was able to drag and drop the controls.
For Visual Studio 2017 I did not fix the problem, but I found a workaround:
went to C:\Users\user.name\AppData\Local\Microsoft\VisualStudio\15.0_e3603226
deleted all *.tbd, privateregistry.bin*, ApplicationPrivateSettings.xml files
deleted all files in ComponentModelCache folder
restarted Visual Studio as Administrator
it showed a message of updating the MEF files
drag and drop is NOT working. It keeps throwing the same error
BUT I can click on the item I want in the toolbox and then click on the designer without dragging and it works.
For Visual Studio 2015 I did not fix the problem, but I found a workaround:
went to C:\Users\user.name\AppData\Local\Microsoft\VisualStudio\14.0
deleted all *.tbd, *.lock, devenv.exe.config files
deleted all files in ComponentModelCache folder
restarted Visual Studio as Administrator
drag and drop is NOT working. It keeps throwing the same error
BUT I can click on the item I want in the toolbox and then click on the designer without dragging and it works.
I have also seen the same problem repeated today in Visual Studio 2019 (Today is June 27 2019). I am trying out the VS 2017 solution from CristisS (above). I have verified that the 'workaround' still throws the exception, however, you can immediately draw the tool onto the form.
I repeatedly run into the same issue. Seems to always be caused by running the Windows Forms designer on my secondary monitor. I don't know what causes it to misbehave, but moving Windows Forms Designer window back to my laptop screen always fixes the issue. Idk if it has something to do with scaling, or what, but it is a very repeatable issue that needs to be addressed.
Moving Visual Studio over from my hi res secondary monitor to my primary laptop monitor did fix the issue.
To use Visual Studio on my larger secondary monitor, I set my secondary monitor from 3840x2160 down to 2560x1440 and set scaling from 150% down to 100%
This lets me Drag and drop from the toolbox to the designer in Visual Studio 2019 (V16.11.3) without issue again.
I found two solutions, to this problem that they worked for my WPF project in VS2015
solution 1) Click on the icon "enable/disable project code" in the bottom of windows design(the last icon near the percentual of zoom)-->Put Disable.
solution 2) Dx mouse button on your file .xaml and apply your modify in blend , selecting the "Open in Blend..." menu.
That's all
Daniel.

Can I have multiple rows of tabs in SQL Server Management Studio

I'm wondering if it's possible to setup SQL Server to have multiple rows of tabs for files / queries.
I have a lot of queries I want to switch between, and could move them to different horizontal groups, but I think two rows would be much easier to navigate than that pin on the left that drops down the big list of open queries.
Visual Studio kind of supports this if you pin enough code windows to fill up the top bar.
Is there something similar in SQL Server?
Edit:
I'm trying to achieve something like this (screenshot from Visual Studio)
While SQL Server is more like this
It's now available in current ssms version. From menu => Tools => options:
By default SSMS includes Database name, File name, Login name and server name in each query tab title. So that we can see only 3 or 4 tabs at a time.
There is a work around for this,
go to Tools > Options > Text Editor > Editor Tab and Status Bar and change all of the "Tab Text" group options to false except for the file name.
This will reduce the tab name, so that SSMS will show more tabs at a time
I know of at least one plugin that will do this in SSMS (and Visual Studio). Because, yeah, it would be nice.
Tabs Studio - document tabs manager for Visual Studio IDE.
You can do this by pinning all the tabs. If tabs are pinned, they won't go out of sight but will go to the next tabline instead.
The last line in the picture is a result of "Show pinned tabs in a separate row" option described in this answer.
You can pin all tabs. Pinned tabs won't be hidden.
You can get a list of open tabs (Active Files) using the Ctrl-Tab shortcut. Continue pressing Tab to cycle through the list and release when the desired tab is highlighted. Or just mouse click on the required tab while keeping Ctrl depressed.
Some people do this by managing their files in an SSMS Solution and keeping the Solution Explorer loaded, but I find these to be inflexible and unwieldy.
SQL Prompt 6 has an "Open Tabs" list in the Tab History feature, which you might also find useful.

Why is my WPF Events Tab gone?

I cannot see it any more in Visual Studio 2010. How can I do to get it back?
I have no addins as I just installed VS Studio.
Nevertheless this occurs on an existing solution with many projects inside. When I create a new WPF project from scratch the tab reappears.
It sounds like a piece of UI is missing from your Visual Studio display. Try the following to get it to show back up in it's original location
Tools -> Import / Export Settings
Select "Reset all settings" and hit Next
Save your current settings if you desire and hit Next
Pick the profile of your choice and hit "Finish"
Possible ways to fix:
Try remove all add-ins and
extensions.
Tools -> Import And Export Setting
-> Reset all settings
Repair Visual Studio installation.
It's not possible to give exact solution with such description of problem.
Your User Options file is broken.
To fix it, do the following:
Close Visual Studio
Go to the folder in which your .sln file reside
Delete the User Options file
Open the solution again
The Events tab is back!
Are you talking about the Properties Window? If the Properties Window is displayed, click on the yellow lightning bolt button towards the top. That will show you the events for the currently selected WPF element. If the Properties Window isn't open, press F4.
This is not a bug, but rather where the focus is set in your visual studio instance design view. From the design view click the window and then do properties (F4). This will enable the events to show and be set from the properties tag. Just make sure the focus is set on the proper item from which you want to set the events (dropdownlist, window, ect.). Hope this helps.
I clicked on the "Design" tab in the bottom and the "Lightning bolt" (Event tabs) reappeared, then it was still available after going into "Source" view mode.
Hope this helps someone.

Why do my toolbox items disappear in Visual Studio 2008?

I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.
Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc...) have vanished leaving only the controls defined within the project.
Resetting the toolbox has no effect. A google search suggested deleting the toolbox temp files in the Local Settings\Application Data\Microsoft\VisualStudio\9.0, however this was only successful in bringing back the default controls for Windows Mobile 5. The WinForms controls are still mysteriously missing.
Also, if I right-click and Select All on the toolbox, all of the WinForms controls do in fact come up, however they're all grayed out.
Has anyone else experienced this?
I just had a similiar problem. In a managed C++ project all the default toolbox items disappeared form the winforms designer. After playing around for a while I found that there was a problem in the .vcproj file.
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="COLLADA Import"
ProjectGUID="{0DEEF9B6-1929-44E3-92EC-13712839FB63}"
RootNamespace="COLLADAImport"
Keyword="ManagedCProj"
TargetFrameworkVersion="0"
>
When you set TargetFrameworkVersion to a valid number, for example 131072 for .Net 2.0, the toolbox items will be back.
If you right click on the Toolbox and select 'Choose Items...' and then sort by the 'Namespace' column, you can then select the ones you need (for example System.Windows.Forms for WinForms).
You can multiselect with Shift and then select/deselect the group.
The controls then reappear in the Toolbox as enabled.
I've noticed this exact same thing for regular WinForms as well. I can't speak to mobile applications but in regular winforms this has a tendency to happen.
I believe it's actually a bug in Visual Studio.
There are some things you can do (again, for WinForms. I'm not sure about mobile) with adding attributes to your control. Such as:
[ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
There are some other useful related things on this site:
http://en.csharp-online.net/Design-Time_Integration-Attributes
I had exactly the same problem (after installing Windows Mobile SDK all items in the toolbox were greyed out).
I've startet the Visual Studio 2008 command line as administrator and started the following command (WARNING - all your settings are lost !!)
devenv /setup /resetuserdata /selfreg /resetskippkgs
After that the toolbox looked fine and worked like on the first day.
The idea came from this thread: connect.microsoft.com
Go to the Tools menu and choose import & export settings, then choose the 'reset all' setting, then yes. Save your current settings, after that you'll have your toolbox reappear.
Actually you may be able to add a registry key to get this to work also.
Make sure you're not in Debug mode.
If you are running Visual Studio 2008 under vista, try running it as an Administrator. Right click on the shortcut and select Run as Administrator.
Well guess what install Service pack 1 for VS 2008 and it would go away and if you have wireless mouse and keyboard turn it off. Choose one of these two both work.

Resources