我刚刚将项目切换到"选项Strict"尝试提高性能,因为我遇到了一些与项目速度有关的问题。
我收到很多错误;许多很容易通过给出字符串转换操作数来修复,但是这个我无法弄清楚
Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for object identity.
此错误专门针对Case目标号码 比如
案例 0
案例 1
案例 2
3
4
5
6
If utable.Rows.Count > 0 Then
pop = 0
For pop As Integer = 0 To utable.Rows.Count - 1
TempStr(0) = CStr(utable.Rows(pop)("UID"))
TempStr(1) = CStr(utable.Rows(pop)("lname"))
TempStr(2) = CStr(utable.Rows(pop)("fname"))
TempStr(3) = CStr(utable.Rows(pop)("uname"))
Select Case utable.Rows(pop)("Usertype")
Case 0
TempStr(4) = "Restricted"
Case 1
TempStr(4) = "Dispatcher"
Case 2
TempStr(4) = "Dispatch Supervisor"
Case 3
TempStr(4) = "Contract Specialist"
Case 4
TempStr(4) = "Account Billing"
Case 5
TempStr(4) = "Manager"
Case 6
TempStr(4) = "Administrator"
End Select
TempStr(5) = CStr(utable.Rows(pop)("Usertype"))
TempNode = New ListViewItem(TempStr)
Dim Add1 As ListViewItem = ListView1.Items.Add(TempNode)
Next
End If
我不熟悉如何修复此任何帮助表示赞赏
答案 0 :(得分:1)
好的,应该这样做:
Select Case CInt(utable.Rows(pop)("Usertype"))
Case 0
...
Case 1
...
End Select