0

パーサー文字列内で選択ケースを実行する必要があります。2番目のフィールドを選択する必要があります(これは正常に機能します)。次に、その2番目のフィールドが返す文字列に基づいて、少し切り替える必要がありますが、何らかの理由でうまく機能していないため、バインドしていない可能性がありますする権利r、わからない。

                Dim r as DataRow
                Dim command = fields(1)
                Select Case command
                    Case 1
                        If fields(1) = "<Left Mouse Down> <Left Mouse Up> <Right Mouse Up>" Then
                            r("Mouse Command") = "Left Click"
                        End If

                    Case 2
                        If fields(1) = "<Right Mouse Down> <Left Mouse Up> <Right Mouse Up" Then
                            r("Mouse Command") = "Right click"
                        End If

                    Case 3
                        If fields(1) = "<Left Mouse Up> <Right Mouse Up>" & Microsoft.VisualBasic.LTrim("Scroll Wheel Roll") Then
                            r("Mouse Command") = "Scroll Wheel"
                        End If

                    Case 4
                        If fields(1) = Microsoft.VisualBasic.LTrim("<Left Mouse Up> <Right Mouse Up> <Press ") Then
                            r("Mouse Command") = "Key Press"
                        End If

                    Case 5
                        If fields(1) = "<Left Mouse Up> <Right Mouse Up>" Then
                            r("Mouse Command") = "Double Click"
                        End If

                End Select

解決済み

4

1 に答える 1

0

fieldどこかの間違ったインデックスにアクセスしていると思います。行Dim command = fields(1)またはIf fields(1) = ...ステートメントのいずれかで。

fields(1)1 から 5 までの数値と以下を含む文字列の両方にすることはできませんLeft Mouse Down ...

たとえば、最初のケースを考えてみましょう:

Dim command = fields(1) '' You're accessing fields(1) here looking for an int
Select Case command
    Case 1
        If fields(1) = "..." '' and here, but looking for a string
...
于 2013-06-18T17:49:51.260 に答える