Solved

Numeric Conversion Algorithms in VB

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

Accepted Solution

by:
khaledc earned 50 total points
Comment Utility
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
For more information see also help in VB under Oct, Hex, CLng.
Hope this answered your question.
One more thing there is no direct way to convert a number into a binary string representation.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now