|
-
Feb 17th, 2000, 04:26 AM
#1
Thread Starter
Lively Member
is there a fuction to convert a number to binary if not how do i do it...
thanks
brooke
-
Feb 17th, 2000, 05:35 AM
#2
Junior Member
Try this:
Dim xint as integer
dim StrString as string
xint = any integer
do until xint <= 0
if raminder(xint,2) > 0 then
StrString = '1' & StrString
xint = (xint-1)/2
else
StrString = '0' & StrString
xint = xint/2
end if
loop
StrSting = binary number
-
Feb 17th, 2000, 05:49 AM
#3
Thread Starter
Lively Member
-
Feb 17th, 2000, 01:26 PM
#4
Addicted Member
Take a look at this article, it has exactly
what you are looking for.
http://www.vb-world.net/misc/addins/
-
Feb 17th, 2000, 04:14 PM
#5
Hyperactive Member
Try this
Public Function Bin_conv(Byval value as long) as string
Dim multi As Long
Dim binary As Variant
multi = 0
binary = 0
If value > 2048 Then
msgbox = "**Overflow**"
Exit Function
End If
Do While (value > 0)
remainder = value Mod 2
value = Fix(value / 2)
If remainder = 1 Then binary = binary + 10 ^ multi
multi = multi + 1
Loop
Bin_conv = binary
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|