Convert RadioButton control to check box control in c#
Solution 1:
The RadioButton control cannot be converted to a Checkbox control because they are not in inheritance hierarchy.
However if you need to do that, you can create a Checkbox control copying the properties that are common for then, and you need to reuse, and then, switch their visibility:
private CheckBox GetCheckboxFromRadioButton(RadioButton radioButton)
{
CheckBox result = new CheckBox();
//copy text
result.Text = radioButton.Text;
//copy colors
result.BackColor = radioButton.BackColor;
result.ForeColor = radioButton.ForeColor;
//copy checked state
result.Checked = radioButton.Checked;
//copy parent container
result.Parent = radioButton.Parent;
//copy size and location
result.Bounds = radioButton.Bounds;
//copy layout behavior
result.Dock = radioButton.Dock;
result.Anchor = radioButton.Anchor;
//enabled property
result.enabled = radioButton.Enabled;
// copy other properies you need here
//...
return result;
}