Windows Application .. Not working - c#

after I did this application using visual C# ... Simply nothing on the form is working its like disconnected any ideas why ?

Check if the event handlers for the Button.Click events are set. Visual Studio tends to drop the event handlers some times.
Open up your form in design mode and check if the click event is set for your buttons by inspecting them in the property grid. If they aren't then you can reselect the method using the drop-down menu.

Related

Event for toolbars visibility

Installed products
Visual Studio 2017 15.6.1
Description
Visual Studio extension that contains a toolbar with drop down combo still receives advised selection(IVsSelectionEvents) events after toolbar is hidden.
Steps to recreate
Use Drop Down Combo from https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/Combo_Box sample
Use IVsMonitorSelection.AdviseSelectionEvents()
Hide the toolbar.
Current behavior
I could not find any event to be notified when toolbar is hidden/shown so could not stop receiving IVsSelectionEvents interfaces OnSelectionChanged event.
Expected behavior
Notified when toolbar is hidden or shown so Advise/UnadviseSelectionEvents() could be called.
So, i need an event that is triggered when toolbar is shown and hidden.

SelectedIndexChanged Event not available in Visual Studio?

I am using Visual Studio Professional 2012, and I am working on a Windows Forms Application. While working with the datagrid view, the selectedIndexChanged Event is not available in the list of available events. How can I implement this event?
screenshot
There is actually no such event in a DataGridView. You can search the msdn help. Use SelectionChanged event instead.

C#/.NET - View a list of system events ie. Windows that have been displayed, buttons that have been clicked etc

I'm completely new to C# and the .NET framework so forgive me if this is a silly question.
Is there any way of viewing a list of all of the events that have happened on a Windows system as a result of keystrokes and mouse movements etc.? So for example when I click on the Start menu, the Start menu is displayed or when I click the "Apply" button within a settings sub-menu, the settings are applied.
Is there any part of the .NET framework that will allow me to view all of these events/actions and record them via a C# program? Any help would me greatly appreciated! Thanks in advance.
UI Automation API is what you need. For listening automation events there are few kinds of handlers: AutomationEventHandler, StructureChangedEventHandler and 2 others.
There is another way for native windows: global mouse and keyboard hooks. See SetWindowsHookEx function.
C# in visual studio designer gives you the ability to respond to all kinds of events, like mouse moves and clicks. If you click on the object you want events from, then go to the events pane, you will see a list of all the events for that object. double click in the textbox next to it and it will auto-generate an event handler in your code. When the event is triggered, it will go to this method and do any code you provide there; IE log the action however you choose.

In Visual Studio 2012 why is a message box in the project shown as the project loads?

In Visual Studio 2012, I added a message box to the load event of a WinForms user control that will pop up if the user control was not initialized correctly (when the load event is fired). All the check does is see if a couple of member variables in the user control are null or not.
The user control is in a different project from the main application because it will be used by more than one application.
The intended sequence of events is this:
In the main application, there is a right click menu with an option to show a window. That window contains the user control being referred to. When the user selects that menu item it creates an instance of the window, initializes the window through an initialization method, which in turn sets the variables in the user control to initialize it. Then the form.Activate method is called, then ShowDialog() and Focus() for the window containing the user control.
Here's the issue:
When I load the solution in Visual Studio 2012, while the solution is being loaded and before any code is shown, the message box is sometimes shown as a modal dialog of Visual Studio itself. The solution does not continue to load until I dismiss the message box.
Also, the message box is sometimes shown when I debug the application, popping up immediately after the login window of the application is shown. I can't seem to find any pattern to why the message box is shown in these two instances.
This is very mystifying as the code is not even executing, yet the message box is being shown. And during application start up the message box is shown even though the right click menu has not been selected.
To be honest I'm not even sure what information to give about this to get an answer. Any information pointing me in the right direction would be appreciated.
So that others like myself can see the answer to this question, Prix and Jonathon Reinhart have provided excellent answers in the comments to my question. But for completeness I'll just sum up.
The load event is fired as soon as the form or user control is ready. The user control is loaded on application start up so that it will be available to use in any form, which is what Prix is talking about. MSDN says this about the load event "Occurs before a form is displayed for the first time." Apparently this can mean even while starting your application, and not necessarily right before being shown.
In other words the load event is not the correct place to put an initialization check.
As for the message box being shown when the solution is loaded in Visual Studio, Jonathon Reinhart provided the key here. Apparently, the visual studio designer interface uses the load event to show the user control in the designer, so the code is executed as the designer loads your user control as well.
Mystification de-mystified. Thank you Prix and Jonathon. Such a simple answer, but I sure was stumped.

Win Forms Key press events do not get triggered when Form is invoked from System.AddIn Adapter

I am using System.AddIn library from .NET 3.5 AddIn & Extensibility features. I have a requirement to add a Button in the toolbar of the existing application which acts as Add Host. I was able to add the button and invoke the custom Win Form from the button click action.
OnClick of the Add-In button, I am invoking a win form which loads WebBrowserControl. Every thing work perfect except the none of the Keyboard events get triggered. If I make my form as Dialog window Keyboard events get triggered. I am bit blocked due the behavior. Any inputs would be appriciated.
Thanks,
Nags

Categories