从字符串“ Label9”到类型“ Double”的转换无效

时间:2019-03-20 06:36:06

标签: vb.net

我做了一个tableadapter查询,将查询结果显示在label9.text上 但是我需要做出ifelse语句,如果label9.text <= 0,那么它将显示一个消息框。

select min(id), value
from table
group by value

1 个答案:

答案 0 :(得分:0)

如果您确定label9.text是有价值的,请尝试将其解析为如下所示的两倍,然后尝试

 Try
            Dim pay As Double = Double.Parse(Label9.Text)

            If pay <= 0 Then
                MessageBox.Show("This Loan is already fully paid", "Paid")
            Else
                ''Do what ever you want
            End If
        Catch e As Exception

            ''error means label9 text is not valid numeric value
             MessageBox.Show("Wrong value", "Not Valid Pay value")

        End Try