How to not set focus to CrystalReportViewer automatically? - visual-studio

There is a problem i am facing, whenever I am setting the ReportSource property of CrystalReportViewer, the CrystalReportViewer control automatically steals focus from other controls. Like lets say I have a button I press which has the code to show the report in the report viewer, after this code is done, the CrystalReportViewer1 will have focus now. I dont want this to happen, I want the button to retain the focus. Also setting the focus back to the button is not possible gracefully as the time the CrystalReportViewer1 takes to render the report and set focus to itself is unpredictable, and there are no straight ways to know for sure when CR viewer is done doing its thing, there are some shortcuts/hacks which I dont want to follow.
I am using windows forms visual studio 2015.

Go to Properties of CrystalReportViewer and set
initialFocus = ParameteralPanel.
Please find Image here:

Related

Change .Text-property in designer without property-window

I am pretty sure in an earlier installation of visual studio I was able to hit F2 in the winforms designer to directly change the .Text property of the selected Winforms-Control (i.e. button).
This way I did not have to switch over to the property-window to search the .Text property. A nice time saving feature.
Unfortunately my active installation of VS 2017 doesnt support this or it is not activated in the settings, which I cant find an option for.
I'd appreciate if you could name me the option if you are aware of it.
F2 is typically tied to loading the Object Browser.
You should be able to select the control and start typing. When you select a control with the Property Window open, you should see that the Text property is automatically selected, but not in edit mode (the cursor is not in the input box). It jumps to edit as soon as you start typing.

How to give the focus (back) to my Visual Studio tool window

My project is a Visual Studio Extension which has a tool window. The tool window contains a grid control. A line in the grid corresponds to some part of a source code file, XAML file, ASP file or WinForms UI.
When you click in a cell in the grid, I want to find the corresponding think in your project, open it, select it, but afterwards I want the focus to be in the cell where you originally clicked, in the grid, in my tool window.
This used to work, but it is not working in my current version, in particular after selecting text in a XAML file.
To select text in the XAML file, I
start with the ProjectItem
open the corresponding window
activate it with window.Activate()
get the TextDocument object
manipulate the TextDocument.Selection to select text
After that I set the focus back to my tool window, by
casting the ToolWindowPane to IVsWindowFrame
calling the show method IVsWindowFrame.Show()
possibly setting the focus to a specific control in my tool window (but that is not really relevant)
I have made (at least) three significant changes:
I am using Visual Studio 2019
I am using async and await at a lot of places (but still running on the main thread)
My top level control is now a WPF control. Formerly it was WinForms
Maybe Visual Studio 2019 is doing something asynchronous in the XAML window, which was previously synchronous. This might mean that I set the focus back to my tool window, but lose it again immediately.
Is there a better way to force the focus back to my tool window?
Alternatively, is there some event I should wait for, before calling IVsWindowFrame.Show()?

Is there a way to copy FormDesign appearance from one button to the next?

So I created a lot of buttons (a-z). Unfortunately, when I reopened the document later, they're all blacked out and I'm having to go through and individually change the buttons appearance one at a time.
Is there a 'format painter' of some kind in visual studio express so that I can just change one's appearance, then copy that over to each next button?
The Windows Forms, WPF and other UI designers in Visual Studio allow you to select multiple controls at once, by Ctrl+Click, Shift+Click or by dragging a selection ("rubber band") rectangle around the relevant controls.
Once you've done that, the properties editor displays those properties that the controls have in common. Changing a property changes it for all of the selected controls.

Fields in the XAML editor Property window becoming un-responsive

Edit: I see "Silverlight -" is in front of my question, which I realize may have something to do with the alphabetical order of my tabs... really Visual Studio 2013 should be in front, anyone know if that can be changed?
I've been using the newer Visual Studio 2013 for about a week now, and I've found some quirks with it. The one that seems to happen the most is when I'm in the XAML editor working on something, suddenly if I go over to the property window I can't enter anything. I'm not running/debugging. I can type stuff in the regular XAML code editor window.
Even stranger, one of the times, I could get the cursors to appear in the fields. I typed a bunch of junk and just one character from what I types appeared. Another time I couldn't enter values into the properties, but I could double click on an event in the events window and create a new event handler. Just a minute ago I had the opposite, where I couldn't double click in the events window.
I think VS 2013 introduced async handling of more things, could it be related to that? Or perhaps because I'm using Silverlight? Right now my only workaround is to restart VS, does anyone have any knowledge about this? Anyone else experienced this?
I'm going to submit a bug report, but it would be a while before there's a patch, so I'm wondering if maybe someone understand the problem better and has a workaround? Or maybe just confirm that this exists and that I'm not crazy/my computer's haunted.
Edit:
I should mention another weird thing that happened two nights ago. I thought it was some how my doing, but I never figured out how I could have managed it without noticing. I was working on a piece of code, went to run after changing a few lines, and suddenly I had a ton of compiler errors. I go over to a user control I haven't touched in hours and suddenly the main LayoutRoot grid is completely empty. Luckily I'd committed to source control, but still...
I found an easy way to deal with this problem. It happens a lot after debugging so what I did was I created a batch file on my desktop containing this line taskkill /f /im XDesProc.exe and I run it every time the properties start misbehaving. Its the quickest way to reload the designer's functionality. I submitted this bug to microsoft they claim it will be included in the next update.
Me and another guy are developing a silverlight app and having the same exact problem. I accidentally found where the bug lies and how to mess with it to allow you to type "very briefly". Apparently this has something to do with tooltips. If you hover over anything in the property window when this bug is happening and allow a tooltip to popup while your cursor is blinking in a field, for the duration that the tooltip is up you can resume typing normal. As soon as the tooltip times out and disappears you can't type. So the only way you can edit or search properties is while a mouse tooltip is floating active. Very unusual. Can't seem to find any kind of tooltip settings in the program and the situation is very hard to find on google because search results assume your talking about programming tooltips. As far as I know we have had this issue since before release candidate. We are currently on official update 1 with the same problem persisting.

How to turn off creating events when pressing enter in VS Windows Forms designer?

I frequently find myself accidentally clicking enter when I'm laying out a form in Visual Studio. Whatever the focus is on when I accidentally hit enter, an event method is created in the code.
And you can't just delete the method because its defined in the designer file so you have to go in there and remove code from the designer. I don't find the Enter = create event functionality to be useful in the designer. Is there a way to turn that off?
I seriously doubt it, no config for this in Tools + Options. But be sure to use the normal workaround: type Ctrl+Z, it works. And Y to dismiss the "are you really sure" message box.
If you just press Ctrl+Z,Y, any other unsaved changes you've made on the designer window (such as adding or moving controls) will be lost.
If you type Ctrl+Tab (to return to the designer window), and then type Ctrl+Z, only the insert of the empty event handler will be undone - other changes will be preserved.

Resources