Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
Namespace extodd
{
Public partial class form1: Form
{
Public form1 ()
{
Initializecomponent ();
}
// Convert binary to octal
Private void button#click (Object sender, eventargs E)
{
Try
{// Convert binary to decimal
Int intten = convert. toint32 (textbox1.text. Trim (), 2 );
// Convert the decimal number to the octal number
Textbox2.text = convert. tostring (intten, 8 );
}
Catch (exception ee)
{
MessageBox. Show (EE. Message );
}
}
// Convert binary to hexadecimal
Private void button2_click (Object sender, eventargs E)
{
// Convert binary to decimal.
Int intten = convert. toint32 (textbox1.text. Trim (), 2 );
// Convert the decimal number to the octal number
Textbox2.text = convert. tostring (intten, 16 );
}
}
}