Advertisement
Guest User

Untitled

a guest
May 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Private Sub CommandButton1_Click()
  2. Dim Text As String
  3. Dim str As String
  4. Text = TextBox1.Text
  5. 'A = Devider(Text)
  6. 'MsgBox (A(1))
  7. MsgBox (DEC_BIN(Val(TextBox1.Text)))
  8. End Sub
  9.  
  10. Function Devider(Text As String) As Variant
  11. Dim A(1 To 1000) As String
  12. Dim k As Single
  13. Dim n As Integer
  14. k = Len(Text) / 32
  15. If Fix(k) = k Then
  16. n = k
  17. Else
  18. n = k + 1
  19. End If
  20.  
  21. For i = 1 To n
  22. A(i) = Mid(Text, (i - 1) * 32 + 1, 32)
  23. Next i
  24. qwe = A
  25. End Function
  26. Function DEC_BIN(dec As Long) As String
  27. DEC_BIN = dec Mod 2
  28. If dec \ 2 <> 0 Then
  29. DEC_BIN = DEC_BIN(dec \ 2) + DEC_BIN
  30. End If
  31. End Function
  32.  
  33. Function BIN_DEC(x As String) As String
  34. For i = 1 To Len(x)
  35. s = s + Mid(x, i, 1) * 2 ^ (Len(x) - i)
  36. Next i
  37. DBL_DEC = s
  38. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement