本文介绍了数值验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何人都可以更正以下代码.我正在尝试限制字符串中的数字值.

我遇到以下错误在'='附近的语法不正确".

我是VB .NET的新手.请帮我解决这个问题.

Hi,

Can anybody correct the below code. I am trying to restrict the numeric values in a string.

I am facing the following error "Incorrect syntax near ''=''".

I am new in VB .NET. Please help me to solve this.

If po_Country.cn_name = "" Then
            o_General.lp_AddPipe(ls_ErrMsg)
            ls_ErrMsg = ls_ErrMsg + "Country Name can not be empty."
        ElseIf po_Country.cn_name.Contains("0-9") Then
            o_General.lp_AddPipe(ls_ErrMsg)
            ls_ErrMsg = ls_ErrMsg + "Country name can not contain numeric values."
        End If



问候,
Srikar



Regards,
Srikar

推荐答案

If po_Country.cn_name = "" Then
    o_General.lp_AddPipe(ls_ErrMsg)
    ls_ErrMsg = ls_ErrMsg + "Country Name can not be empty."
ElseIf po_Country.cn_name.Contains("0-9") Then
    o_General.lp_AddPipe(ls_ErrMsg)
    ls_ErrMsg = ls_ErrMsg + "Country name can not contain numeric values."
End If


通过键入以下命令使它看起来像这样:


I made it look like that by typing this:

<pre lang="vb">If po_Country.cn_name = "" Then
    o_General.lp_AddPipe(ls_ErrMsg)
    ls_ErrMsg = ls_ErrMsg + "Country Name can not be empty."
ElseIf po_Country.cn_name.Contains("0-9") Then
    o_General.lp_AddPipe(ls_ErrMsg)
    ls_ErrMsg = ls_ErrMsg + "Country name can not contain numeric values."
End If</pre>


结束我本可以为您做的,但是我宁愿教您如何做,而不是为您做.


I could have done that for you, but I would rather teach you how to do it than do it for you.




这篇关于数值验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 22:42