Posts

Showing posts with the label C#

Programmatically Start/Stop Windows Service

Source: http://www.dotnetspider.com/resources/865-How-start-stop-windows-services-programmati.aspx [C#] using System.ServiceProcess; // add .Net Reference to Project ServiceController controller = new ServiceController(); controller.MachineName = "."; controller.ServiceName = "MySQL"; string status = controller.Status.ToString(); // Stop the service controller.Stop(); // Start the service controller.Start();

Ways to Disable ButtonEdit

Image
To disable ButtonEdit Editing and Button click, but still allowing Selection and ContextMenu   buttonEdit1.Properties.ReadOnly = true; To disable ButtonEdit Editing, Selection, ContextMenu, but still allowing Button click   buttonEdit1.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; To disable ButtonEdit Right-Click Context Menu   ContextMenu emptyMenu = new ContextMenu();   this.components.Add(emptyMenu);   buttonEdit1.Properties.ContextMenu = emptyMenu; To disable ButtonEdit completely   buttonEdit1.Enabled = false;