如何在vb.net中检查列表索引值是否为空 [英] how to check list index value is empty in vb.net
本文介绍了如何在vb.net中检查列表索引值是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hai我不知道如何检查列表值
例如
hai I don't know how to check the list value
for example
LocList = New List(Of List(Of String))
LocList是包含值的列表
LocList is the list contains values
LocList.Add("")
LocList.Add("one")
LocList.Add("")
LocList.Add("two")
LocList.Add("three")
如何检查loclist(0)和loclist(2)是否为空
how to check the loclist(0) and loclist(2) is empty or not
推荐答案
试试..
try..
For Each str As String In LocList
If (String.IsNullOrEmpty(str)) Then
MessageBox.Show('empty')
End If
Next
没有ForEach循环..
尝试
Without ForEach loop..
try
if LocList.Length>=1 then ' checking length of the list
If (String.IsNullOrEmpty(list.Item(0))) Then
MessageBox.Show('empty')
End If
End If
试试这个:
Try this:
If LocList.Item(0) = String.Empty Then
'do something
End if
这篇关于如何在vb.net中检查列表索引值是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文