MarcoAndresito Asked: 2020-07-19 12:58:08 +0800 CST 2020-07-19 12:58:08 +0800 CST 2020-07-19 12:58:08 +0800 CST VB.net如何验证空值? 772 如何检查变量是否为Null? 我已经尝试过: If a Is null Then 'a tiene valor nulo Else 'a es diferente de valor nulo End If vb.net 1 Answers Voted Best Answer Dev. Joel 2020-07-19T13:14:32+08:002020-07-19T13:14:32+08:00 为了验证nullVB.net 中的值Nothing,它基本上表示正在使用的数据类型的默认值。验证将是 If (a is Nothing) Then ... End If 您还可以使用 String 类的IsNullOrEmpty方法。 If String.IsNullOrEmpty(a) Then . .. End If 作为推荐阅读this question and answer,在这一点上更深入地详细说明
为了验证
null
VB.net 中的值Nothing
,它基本上表示正在使用的数据类型的默认值。验证将是您还可以使用 String 类的IsNullOrEmpty方法。