// Convert decimal to binary
String str = Convert. ToString (69, 2 );
// Convert decimal to octal
String str = Convert. ToString (69, 8 );
// Convert decimal to hexadecimal
String str = Convert. ToString (69, 16 );
// Convert binary to decimal
String str = Convert. ToInt32 ("100111101", 2 );
// Octal to decimal
String str = Convert. ToInt32 ("76", 8 );
// Convert hexadecimal to decimal
String str = Convert. ToInt32 ("FF", 16 );
// In ToString, X represents the string format converted to a hexadecimal string. uppercase/lowercase x represents the case format of the converted string. x is followed by a number: the length of the converted string, which is less than zero.
Int d = 18;
D. ToString ("X4 ");
// Exercise the 9 th multiplication table
System. Web. UI. HtmlControls. HtmlForm frm = this. form1;
Label lb = new Label ();
Lb. Text = "9-9 multiplication table ";
Lb. Style. Add ("color", "red ");
Lb. Style. Add ("font-size", "18px ");
Frm. Controls. Add (lb );
For (int I = 1; I <10; I ++)
{
For (int j = 1; j <10; j ++)
{
If (j <= I)
{
Button btn = new Button ();
Btn. Text = string. Format ("{0} * {1} = {2}", I, j, I * j );
Btn. Attributes. Add ("onclick", "alert (this. value); return false ;");
Btn. Style. Add ("position", "absolute ");
Btn. Style. Add ("left", string. Format ("{0} px", j * 75 ));
Btn. Style. Add ("top", string. Format ("{0} px", I * 25 ));
Btn. Style. Add ("width", "75px ");
Btn. Style. Add ("height", "25px ");
Frm. Controls. Add (btn );
}
Else
{
Break;
}
}
}