How to print Binary digit
Dear friends,
I am coding in Visual C# windows application. I like to set a Label Text property with given integer's binary.
eg. I have 1 Label, 1 TextBox and 1 Button when i type 4 in textbox and click on button i want to set label text property with number four's binary that is 0000 0100.
Kindly tell me how i can print Binary on Form.
Re: How to print Binary digit
Quick google search revealed this:
Code:
int i = 100;
string str = Convert.ToString(i, base); //base = 2, 8,10 or 16
You'll obviously want to use base 2 for binary.
Re: How to print Binary digit
Thank you very much dear it works nice.