Dim n As Integer
Dim m As Integer
For n = 0 To hshu - 2
For m = 1 To 5
Select Case m
Case 1
eid = Str(Form2.SdDataGridView.Rows(n).Cells(1).Value)
RedataDataGridView.Rows(n).Cells(1).Value = eid
Case 2
label = Str(Form2.SdDataGridView.Rows(n).Cells(2).Value)
RedataDataGridView.Rows(n).Cells(2).Value = label
Case 3
data = Str(Form2.SdDataGridView.Rows(n).Cells(3).Value)
Case 4
ssm = Str(Form2.SdDataGridView.Rows(n).Cells(4).Value)
Case 5
sdi = Str(Form2.SdDataGridView.Rows(n).Cells(5).Value)
End Select
labelhanshu = label
Select Case labelhanshu
Case "162"
RedataDataGridView.Rows(n).Cells(4).Value = label162(data)
Label4.Text = 22222
Case "035"
RedataDataGridView.Rows(n).Cells(4).Value = label035(data)
Case "201"
RedataDataGridView.Rows(n).Cells(4).Value = label201(data)
Case "033"
RedataDataGridView.Rows(n).Cells(4).Value = label033(data)
Case "034"
RedataDataGridView.Rows(n).Cells(4).Value = label034(data)
Case "222"
RedataDataGridView.Rows(n).Cells(4).Value = label222(data)
Case "202"
RedataDataGridView.Rows(n).Cells(4).Value = label202(data)
Case "173"
RedataDataGridView.Rows(n).Cells(4).Value = label173(data)
Case "174"
RedataDataGridView.Rows(n).Cells(4).Value = label174(data)
End Select
Next
RedataBindingSource.AddNew()
Next
如代码所示,我从datagridview 得到label 字符,但在第二条select case 语气中却不会判断 case 条件。我确信label 字符的内容是case 判断条件的其中一个。
------解决思路----------------------
F10一步一步跟跟踪调试看看对应的值...
------解决思路----------------------
labelhanshu 的类型是字符串还是整型...
------解决思路----------------------
我怎么看你的是labelhanshu=" 222" 而不是labelhanshu="222"...你检查下是不是前面有空格...