我的VB.NET计划出错了。我已经尝试了各种演员等,但它只是不能解决问题 - 所以我不情愿地在这里发帖,看看是否有其他人有类似的问题。
错误1选项Strict On禁止从“Object”到“String”的隐式转换。
Private DS As New DataSet ' Languages
Function TransTxt(ByVal Frm As String, ByVal Item As String) As String
Dim language As String
Select Case My.Settings.Language
Case 0 : language = "en" ' English
Case 1 : language = "fr" ' French
Case 2 : language = "it" ' Italian
Case 3 : language = "sp" ' spanish
Case 4 : language = "pt" ' portuguese
Case 5 : language = "de" ' german
Case 6 : language = "du" ' dutch
Case Else : language = "en" ' English
End Select
Try 'ONE of these rows is the error
Dim DR() As DataRow = DS.Tables(Frm).Select("Tag = '" & Item & "'")
Return DR(0).Item(language)
Catch ex As Exception
Return "- error -" & Item
End Try
End Sub
答案 0 :(得分:4)
Return DR(0).Item(language)
是我的猜测。
CAST
到STRING
类型或最后使用Return DR(0).Item(language).ToString()
。