Advertisement
ASP_Volume2 Miscellaneous #36914

barcode

I looked high and low for some type of code snip that showed how to create a barcode (none where available except the ones for sale). So here is one way to print a code 39 barcode in VB. It has worked for me, although very little testing was done.

AI

AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

源代码
original-source
Upload
' General Logic
' If bytes < 1000 Then ### Bytes
' ElseIf bytes < (2^10 * 10) Then #.## KB
' ElseIf bytes < (2^10 * 100) Then ##.# KB
' ElseIf bytes < (2^10 * 1000) Then ### KB
' ElseIf bytes < (2^20 * 10) Then #.## MB
' ElseIf bytes < (2^20 * 100) Then ##.# MB
' ElseIf bytes < (2^20 * 1000) Then ### MB
' etc...
Function FormatBytes(ByVal Bytes)
	Dim strType, x, y, z
	strType = Array("KB","MB","GB","TB","PB","EB","ZB","YB")
	If Bytes < 0 Then Exit Function
	If Bytes < 1000 Then
		FormatBytes = Bytes & " Bytes"
		Exit Function
	End If
	For x = 1 to 8
		z = 2^(x*10)
		For y = 1 to 3
			If Bytes < z*(10^y) Then
				FormatBytes = FormatNumber(Bytes/z, 3-y) & " " & strType(x-1)
				Exit Function
			End If
		Next
	Next
End Function
原始评论 (3)
从 Wayback Machine 恢复