【问题标题】:Conversion from string "FalseTrue" to type 'Boolean' is not valid issue从字符串“FalseTrue”到类型“Boolean”的转换不是有效问题
【发布时间】:2013-10-02 02:03:55
【问题描述】:

从字符串“FalseTrue”到类型“Boolean”的转换无效。在这种情况下我该如何解决? Label5.Text 必须包含那些,它不能相等,因为它们提供了包含日期在内的 EST 的完整转换时间。

If ((Label5.Text.Contains("8:00") Or Label5.Text.Contains("1:35")) & (Label5.Text.Contains("PM"))) Then
        WebControl1.Source = New Uri("http://www.flalottery.com/play4.do")
        Label1.Text = "Loading in 7 seconds..."
        Label2.Text = "Loading in 7 seconds..."
        Refresh.Start()
End If

Winforms VB.NET 2012 Express。

【问题讨论】:

  • 已解决。再次感谢。

标签: vb.net string winforms if-statement boolean


【解决方案1】:

您使用了字符串连接运算符&,而不是逻辑And 运算符:

If ((Label5.Text.Contains("8:00") Or Label5.Text.Contains("1:35")) And (Label5.Text.Contains("PM"))) Then

【讨论】:

  • 谢谢你们俩。已经很晚了,我才注意到这一点。
【解决方案2】:

使用将连接两个值的VB & 符号,您想使用And 代替

【讨论】:

  • 谢谢你们俩。已经很晚了,我才注意到这一点。
猜你喜欢
  • 1970-01-01
  • 2018-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-07
  • 2011-07-30
相关资源
最近更新 更多