如何解决禁止从布尔到字符串的隐式转换的选项严格? [英] How do I solve option strict on disallows implicit conversion from boolean to string?
本文介绍了如何解决禁止从布尔到字符串的隐式转换的选项严格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到Option Strict On禁止在[b]上从'Boolean'隐式转换为'String'错误[/ b]
如何解决这个问题?
I am getting Option Strict On disallows implicit conversions from 'Boolean' to 'String' on [b]False[/b]
How do I solve this?
If Not blnInvalid Then
'Check if the citation is a duplicate
strCitationNumbers = Msc.Integration.Mncis.Library.v4.Citation.GetCaseNumbersForCitation(strCitationNumber, False)
If (strCitationNumbers(0) <> "No Matching Case") Then
'add the error message
CType(objXMLCitationNode, XmlElement).SetAttribute("validationError", "This is a duplicate citation.")
End If
End If
我尝试过:
以下代码行是生成Option Strict On禁止从'Boolean'到'String'的隐式转换
What I have tried:
The following line of code is generation Option Strict On disallows implicit conversion from 'Boolean' to 'String'
strCitationNumbers = Msc.Integration.Mncis.Library.v4.Citation.GetCaseNumbersForCitation(strCitationNumber, False)
推荐答案
你是变量尝试更新或传递的值作为引用,期望String
值,但它获得Boolean
值。
你可以这样做;
The variable you are trying to update or the value to pass as a reference, is expecting aString
value, but it gets aBoolean
value.
You can do;
strCitationNumbers = Msc.Integration.Mncis.Library.v4.Citation.GetCaseNumbersForCitation(strCitationNumber, "False")
这篇关于如何解决禁止从布尔到字符串的隐式转换的选项严格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文