Solved

# Numeric Conversion Algorithms in VB

Posted on 1998-07-20
275 Views
I need to figure out an algorithm (or algorithms) for converting a variable (string) from decimal to hexadecimal, binary, and/or octal.
0
Question by:grib01
1 Comment

LVL 1

Accepted Solution

khaledc earned 50 total points
If I get you right, First you have to convert a string to a decimal, then from decimal to hexadecimal, binary or octal.
First, you can convert to decimal by using CLng(YourString),  then uses Hex or Oct function to convert hexadecimal or octal as followed:
Dim MyLong as Long
Dim MyStr as string
MyLong=cLng(YourString)
MyStr = Hex(MyLong)      'Or to convert to Octal
MyStr = Oct(MyLong)     'Oct and Hex return a string representation of an octal or hexadecima number
One more thing there is no direct way to convert a number into a binary string representation.

0

## Featured Post

### Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…