How to Prevent the Toggle Button from changing between Active and Inactive States

9 Dec 20191 minute to read

You have to subscribe to the ToggleStateChanging event and cancel the change. The following code example explains the same.

private void toggleButton1_ToggleStateChanging(object sender, CancelEventArgs e)
   e.Cancel = true;
Private Sub ToggleButton1_ToggleStateChanging(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles ToggleButton1.ToggleStateChanging
e.Cancel = True
End Sub