Welcome to the forums,
I have written a program called "Conversion" a while back. It does exactly what you are looking for and more:
Decimal to Hex
Hex to Decimal
Hex String to Decimal
Decimal to Binary
Binary to Decimal
Float to Binary
Ascii to Binary
Binary to Ascii
It's an open source project. Well, back to your original question I see that you need it done in VB. My source code was written in C, but if you know how to convert C to VB, or anyone else that is a VB expert, that would be helpful.
Here is a look on how to convert Binary to Decimal:
#include <string.h>
int btoi(char *buf) {
// Create local variables
int count, tmp;
int retValue = 0;
// Get length of string
count = strlen(buf);
// Go through string one byte at a time (backwards)
for (i = 0; i <= count; i++) {
// If a number '1' was found
if (buf[count-i] == '1') {
tmp = 1;
for (j = 1; j < i; j++)
tmp *= 2;
retValue += tmp;
}
}
// Return our decimal value
return retValue;
}
*buf is your binary value in string format.
It's pretty much the syntax that will get you started. It's not hard to understand at all. I hope this gets you a head start, and good luck.
- Stack Overflow