台灣最大程式設計社群網站
線上人數
654
 
會員總數:244390
討論主題:188629
歡迎您免費加入會員
討論區列表 >> VB6 >> 有大大能幫我找出問題所在嗎
[]  
[我要回覆]
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
有大大能幫我找出問題所在嗎
價值 : 20 QP  點閱數:1385 回應數:0

樓主

阿Sin
門外漢
0 2
22 4
發送站內信

這是一個身分證產生器並有檢查功能的一個程式碼,可是很奇怪找不出問題在哪,
可以請會的大大幫我檢查看是哪一行出錯(順便跟我說要怎麼修改)並能說明給我聽嗎
拜託各位大大囉......

Public Class Form1
Dim inp As String

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim alpha As String
If ListBox1.SelectedIndex = 0 Then
alpha = "A"
ElseIf ListBox1.SelectedIndex = 1 Then
alpha = "B"
ElseIf ListBox1.SelectedIndex = 2 Then
alpha = "C"
ElseIf ListBox1.SelectedIndex = 3 Then
alpha = "D"
ElseIf ListBox1.SelectedIndex = 4 Then
alpha = "E"
ElseIf ListBox1.SelectedIndex = 5 Then
alpha = "F"
ElseIf ListBox1.SelectedIndex = 6 Then
alpha = "G"
ElseIf ListBox1.SelectedIndex = 7 Then
alpha = "H"
ElseIf ListBox1.SelectedIndex = 8 Then
alpha = "I"
ElseIf ListBox1.SelectedIndex = 9 Then
alpha = "J"
ElseIf ListBox1.SelectedIndex = 10 Then
alpha = "K"
ElseIf ListBox1.SelectedIndex = 11 Then
alpha = "L"
ElseIf ListBox1.SelectedIndex = 12 Then
alpha = "M"
ElseIf ListBox1.SelectedIndex = 13 Then
alpha = "N"
ElseIf ListBox1.SelectedIndex = 14 Then
alpha = "O"
ElseIf ListBox1.SelectedIndex = 15 Then
alpha = "P"
ElseIf ListBox1.SelectedIndex = 16 Then
alpha = "Q"
ElseIf ListBox1.SelectedIndex = 17 Then
alpha = "R"
ElseIf ListBox1.SelectedIndex = 18 Then
alpha = "S"
ElseIf ListBox1.SelectedIndex = 19 Then
alpha = "T"
ElseIf ListBox1.SelectedIndex = 20 Then
alpha = "U"
ElseIf ListBox1.SelectedIndex = 21 Then
alpha = "V"
ElseIf ListBox1.SelectedIndex = 22 Then
alpha = "W"
ElseIf ListBox1.SelectedIndex = 23 Then
alpha = "X"
ElseIf ListBox1.SelectedIndex = 24 Then
alpha = "Y"
ElseIf ListBox1.SelectedIndex = 25 Then
alpha = "Z"
End If


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i, jj, check As Integer


Select Case UCase(inp(0))
Case "0" : jj = 10
Case "1" : jj = 11
Case "2" : jj = 12
Case "3" : jj = 13
Case "4" : jj = 14
Case "5" : jj = 15
Case "6" : jj = 16
Case "7" : jj = 17
Case "8" : jj = 34
Case "9" : jj = 18
Case "10" : jj = 19
Case "11" : jj = 20
Case "12" : jj = 21
Case "13" : jj = 22
Case "14" : jj = 35
Case "15" : jj = 23
Case "16" : jj = 24
Case "17" : jj = 25
Case "18" : jj = 26
Case "19" : jj = 27
Case "20" : jj = 28
Case "21" : jj = 29
Case "22" : jj = 32
Case "23" : jj = 30
Case "24" : jj = 31
Case "25" : jj = 33
End Select

check = (jj \ 10) * 1 + (jj Mod 10) * 9
For i = 1 To 8
check = check + Val(inp(i)) * (9 - 1)

Next
inp = TextBox1.Text

If Val(inp(9)) = 10 - (check Mod 10) Then
TextBox2.Text = "正確"
Else
TextBox2.Text = "錯誤"
End If


End Sub
End Class

本篇文章發表於2007-08-19 23:28
別忘捐VP感謝幫助你的人 新手會員瞧一瞧
目前尚無任何回覆
   

回覆
如要回應,請先登入.