[英]Search subitem in listview and remove item
我正在嘗試將用戶輸入的雙精度數字與listview中包含的子項進行比較。 我嘗試了以下代碼,但是它刪除了錯誤的值,而且似乎無法正常工作。 我想比較
ListView1.Items(index).SubItems(1).Text <= spread_less_then_input.Text
我不確定數字是否為字符串格式這一事實的代碼是否有問題。 這是我目前正在嘗試的代碼
If spread_less_then_input.Text() <> "" And (ListView1.Items.Count <> 0) Then
For index As Integer = ListView1.Items.Count - 1 To 0 Step -1
If ListView1.Items(index).SubItems(1).Text <= spread_less_then_input.Text Then
ListView1.Items.RemoveAt(index)
End If
Next index
End If
只需將字符串轉換為double即可將索引作為Integer = ListView1.Items.Count-1到0步驟-1將Dim用戶輸入作為Double Dim子項作為Double userinput = CDbl(Val(spread_greater_then_input.Text()))子項= CDbl(Val (ListView1.Items(index).SubItems(1).Text))'// Val努力工作(ListView1.Items(index).SubItems(3).Text,result1)如果userinput> = subitem然后是ListView1.Items。 RemoveAt(index)如果下一個索引結束,如果
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.