采用vb以十六进制的形式读取文本文档数据

前端之家收集整理的这篇文章主要介绍了采用vb以十六进制的形式读取文本文档数据前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

窗体上放入一个多行文本框(带纵向滚动条),一个命令按钮:

Private Sub Command1_Click()

Dim ss() As Byte,i As Long

Open "e:\tmp\123.txt" For Binary As #1

ss = InputB(LOF(1),#1)

Close #1

For i = 0 To UBound(ss) 

	If i > 0 And (i Mod 16) = 0 Then 

		Text1.SelText = vbCrLf
		Text1.SelText = Right("0" & Hex(ss(i)),2) & " "
	endif
Next

End Sub
原文链接:https://www.f2er.com/vb/259497.html

猜你在找的VB相关文章