You are taking an input from the TextBox and wanted to convert it into binary or hexadecimal number.
Since you take input from the TextBox you have its datatype is String and you have to convert that String into int, long, etc Depending upon your requirement.
To convert your number to Hexadecimal Number refer to
Hex Converter[
^]
bcoz when you convert string to any numerical form like int, long, float, etc it is in the decimal number only
To convert your Number to any Base like Binary, octal, etc refer to
Conversion of Decimal to any Base (Binary, Octal or Hexa) and vice-versa (C#)[
^]