Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Numeric Conversion Algorithms in VB

Posted on 1998-07-20
1
Medium Priority
?
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
khaledc earned 150 total points
ID: 1466290
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 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