开发者

coversion from string ""to double type is invalid

iam passing a textbox value(the value is 10:1:1) into a string and when iam running the application iam getting the following error "coversion from string "10:1:1" to double type is invalid". kindly find the code below and help me on the same: (also the textbox values should be greater than 0 always)开发者_Python百科

Dim strEncrypt As String = txtData.Text

If strEncrypt > 0 Then // I am getting the error here 
    txtEncryptedData.Text = Encrypt(strEncrypt)
Else 
    MessageBox.Show(
        "Enter the Value greater then 0:")
End If

Thanks, Rams


I believe you want this...

If strEncrypt.Length > 0 Then


Maybe you want:

Function Check(ByVal s As String) As Boolean
    Dim parts As String()
    parts = s.Split(":")
    If parts.Length = 0 Then
        Check = False
    Else
        Check = True
        For Each sval As String In parts
            Check = Check And Int32.Parse(sval) > 0
        Next
    End If
End Function

so you can use it like Check(txtData.Text).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜