private void BtnPowerOff_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; DialogResult resultDia = MessageBox.Show("Do you wish to Power Off the Device ??", "Power Off Device", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resultDia == DialogResult.Yes) { objZkeeper.PowerOffDevice(int.Parse(tbxMachineNumber.Text.Trim())); } Cursor = Cursors.Default; }