buddyB Posted November 13, 2003 Posted November 13, 2003 Dear... I need to convert a hexadecimal code (string of 1 byte) to a binary code (string of 4 bytes). Other possible solutions are okay too. The help-file gives the following solution: Code: -------------------------------------------------------------------------------- �Function HexToBinary( ByVal HexString As String) As String� -------------------------------------------------------------------------------- Does anyone know how to do this ? Regards, BuddyB Quote
Leaders Iceplug Posted November 13, 2003 Leaders Posted November 13, 2003 One solution would probably be to call a few replace methods. Replace 0 with 0000, 1 with 0001, 2 with 0010, 3 with 0011, etc. E with 1110, and F with 1111. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
*Experts* Nerseus Posted November 14, 2003 *Experts* Posted November 14, 2003 Try this: // s is the hex string string s = "C2"; // b will be the binary string string b = Convert.ToString(Convert.ToInt32(s, 16), 2); -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
buddyB Posted November 28, 2003 Author Posted November 28, 2003 Hex To bin Thanks Nerseus. It works wonderfull. This is the first time i use this Form, i think it's really helpfull. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.