Dim X34 As String ="0123456789ABCDEFGHJKLMNPQRSTUVWXYZ" '34进制,去除I和O Private Function CovvertTo34(ByVal val As Integer) As String Dim Result As String = String.Empty While val >= 34 Result = X34(val Mod 34) + Result val = Int(val / 34) End While If val >= 0 Then Result = X34(val) + Result End If Return Result End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Label1.Text = Microsoft.VisualBasic.Right("0000" & CovvertTo34(NumericUpDown1.Value), 4) Label2.Text = Microsoft.VisualBasic.Right("0000" & CovvertTo34(NumericUpDown1.Value + 1), 4) End Sub
第二种方法:
Private Function Tnsfer34(ByVal xInt As Integer) As String Dim xMap24 As String = "ABCDEFGHJKLMN" Dim xMap34 As String = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ" Dim xRetDigit34 As String = "" Dim xxInt As Integer = (xInt Mod 39304) Dim xHead24Int As Integer = Int(xInt / 39304) ' A-Z , 不含 I & O Dim xRetDigit24 As String = Microsoft.VisualBasic.Left(xMap24(xHead24Int), 1) While xxInt > 0 xRetDigit34 = Mid(xMap34, (xxInt Mod 34) + 1, 1) & xRetDigit34 xxInt = Int(xxInt / 34) End While Return xRetDigit24 & Microsoft.VisualBasic.Right(Replace(Space(3), " ", "0") & xRetDigit34, 3) End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Text = Tnsfer34(NumericUpDown1.Value) End Sub