Private yx(-1 To 7, -1 To 6) As String Private sj1 As String, sj2 As String, sj3 As String, sj4 As String Private i As Integer, j As Integer Private a As Integer, b As Integer
'A. 数据方式1 转换为数据方式2,3 Private Sub Form_Click() For j = 1 To 5 For i = 1 To 4 yx(j, i) = "" Next i Next j
sj2 = "": sj3 = "" For j = 1 To 5 For i = 1 To 4 If yx(j, i) <> "*" Then yx(j, i) = Mid$(sj1, (j - 1) * 4 + i, 1): sj3 = sj3 & yx(j, i) Select Case yx(j, i) Case Is = "4" yx(j, i + 1) = "*" yx(j + 1, i) = "*": yx(j + 1, i + 1) = "*" Case Is = "3" yx(j, i + 1) = "*" Case Is = "2" yx(j + 1, i) = "*" End Select End If sj2 = sj2 & yx(j, i) Next i Next j Print "数据方式2 "; sj2 Print "数据方式3 "; sj3
'b.数据方式1 转换为数据方式4 For j = 1 To 5 For i = 1 To 4 yx(j, i) = "" Next i Next j
a = 0: b = 5: C = 10 sj4 = "" For j = 1 To 5 For i = 1 To 4 If yx(j, i) <> "**" Then yx(j, i) = Mid$(sj1, (j - 1) * 4 + i, 1) Select Case yx(j, i) Case Is = "4" yx(j, i) = "10": yx(j, i + 1) = "**" yx(j + 1, i) = "**": yx(j + 1, i + 1) = "**" Case Is = "3" a = a + 1: yx(j, i) = "0" & LTrim$(Str$(a)): yx(j, i + 1) = "**" Case Is = "2" C = C + 1: yx(j, i) = LTrim$(Str$(C)): yx(j + 1, i) = "**" Case Is = "1" b = b + 1: yx(j, i) = "0" & LTrim$(Str$(b)) Case Is = "0" yx(j, i) = "00" End Select End If sj4 = sj4 & yx(j, i) Next i Next j Print "数据方式4 "; sj4
'C.数据方式2 转换为数据方式1 For j = 1 To 5 For i = 1 To 4 yx(j, i) = "" Next i Next j sj1 = "" For j = 1 To 5 For i = 1 To 4 If yx(j, i) = "" Then yx(j, i) = Mid$(sj2, (j - 1) * 4 + i, 1) Select Case yx(j, i) Case Is = "4" yx(j, i + 1) = "4": yx(j + 1, i) = "4": yx(j + 1, i + 1) = "4" Case Is = "3" yx(j, i + 1) = "3" Case Is = "2" yx(j + 1, i) = "2" End Select End If sj1 = sj1 & yx(j, i) Next i Next j Print "数据方式1 "; sj1
'D.数据方式3 转换为数据方式1 For j = 1 To 5 For i = 1 To 4 yx(j, i) = "" Next i Next j a = 0 sj1 = "" For j = 1 To 5 For i = 1 To 4 If yx(j, i) = "" Then a = a + 1: yx(j, i) = Mid$(sj3, a, 1) Select Case yx(j, i) Case Is = "4" yx(j, i + 1) = "4": yx(j + 1, i) = "4": yx(j + 1, i + 1) = "4" Case Is = "3" yx(j, i + 1) = "3" Case Is = "2" yx(j + 1, i) = "2" End Select End If sj1 = sj1 & yx(j, i) Next i Next j Print "数据方式1 "; sj1 'E.数据方式4 转换为数据方式1 For j = 1 To 5 For i = 1 To 4 yx(j, i) = "" Next i Next j sj1 = "" For j = 1 To 5 For i = 1 To 4 If yx(j, i) = "" Then yx(j, i) = Mid$(sj4, (j - 1) * 8 + (i - 1) * 2 + 1, 2) Select Case yx(j, i) Case Is = "10" yx(j, i) = "4": yx(j, i + 1) = "4" yx(j + 1, i) = "4": yx(j + 1, i + 1) = "4" Case Is = "11", "12", "13", "14", "15" yx(j, i) = "2": yx(j + 1, i) = "2" Case Is = "01", "02", "03", "04", "05" yx(j, i) = "3": yx(j, i + 1) = "3" Case Is = "06", "07", "08", "09" yx(j, i) = "1" Case Is = "00" yx(j, i) = "0" End Select End If sj1 = sj1 & yx(j, i) Next i Next j Print "数据方式1 "; sj1 End Sub
|