二进制转十六进制vb6程序
2015-12-04 10:05
597 查看
【原】二进制转十六进制vb6程序
Private Sub Command1_Click()
Dim strN As String, iHex As String, strBin(), strHex()
Dim intXh As Integer, i As Integer, j As Integer, strTmp As String
strBin = Array("0000", "0001", "0010", "0011", _
"0100", "0101", "0110", "0111", _
"1000", "1001", "1010", "1011", _
"1100", "1101", "1110", "1111")
strHex = Array("0", "1", "2", "3", "4", "5", "6", "7", _
"8", "9", "A", "B", "C", "D", "E", "F")
strN = InputBox("", "", "111000111")
If Len(strN) Mod 4 <> 0 Then strN = String(4 - Len(strN) Mod 4, "0") & strN
intXh = Len(strN) \ 4
For i = 1 To intXh
strTmp = Right(strN, 4)
For j = 0 To 15
If strTmp = strBin(j) Then
iHex = strHex(j) & iHex
Exit For
End If
Next
strN = Left(strN, Len(strN) - 4)
Next
MsgBox "0x" & iHex
End Sub
Private Sub Command1_Click()
Dim strN As String, iHex As String, strBin(), strHex()
Dim intXh As Integer, i As Integer, j As Integer, strTmp As String
strBin = Array("0000", "0001", "0010", "0011", _
"0100", "0101", "0110", "0111", _
"1000", "1001", "1010", "1011", _
"1100", "1101", "1110", "1111")
strHex = Array("0", "1", "2", "3", "4", "5", "6", "7", _
"8", "9", "A", "B", "C", "D", "E", "F")
strN = InputBox("", "", "111000111")
If Len(strN) Mod 4 <> 0 Then strN = String(4 - Len(strN) Mod 4, "0") & strN
intXh = Len(strN) \ 4
For i = 1 To intXh
strTmp = Right(strN, 4)
For j = 0 To 15
If strTmp = strBin(j) Then
iHex = strHex(j) & iHex
Exit For
End If
Next
strN = Left(strN, Len(strN) - 4)
Next
MsgBox "0x" & iHex
End Sub
相关文章推荐
- vb6判断动态字节数组是否已经初始化的最简单的办法
- OpenGL ES 学习教程(五) 极速绘制,使用 VBO (顶点缓冲区对象)!
- 导航条(Navbar)
- 防止已启动的VBScript文件重复启动
- 从VBA转到VSTO经历及感受
- Windows与VBox虚拟机共享目录的方法
- Visual Basic 2012 借助DataGridView控件将SQL server2012 数据导入到Excel 2010
- vbs发送请求
- C#/VB.NET 向PowerPoint文档插入视频
- vbs函数大全
- VBS自学(四)
- C#/VB.NET 向PowerPoint文档插入视频
- vb脚本自动更新版本信息
- VB的计划任务的问题
- vbox共享文件 挂载
- vb.net 写入文件同步锁
- Visual Basic 2012 借助DataGridView控件将Excel 2010数据导入到SQL server 2012
- 硬链接与软连接[转自vbird]
- VB和C#中循环语句
- msvbvm50.exewin7修复版