Listview check for space infront of text
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Hello i need help with a listview i have added some text but i want it to see what lines there are spaces before words and then color the row, is this possible if so how ?
i dont know how to check if space but this will help you to check if emphty
Code: Select all
If ListView1.ListItems.Count = 0 Then
Msgbox "ListView is empty"
Else
Msgbox "Listview contains " & ListView1.ListItems.Count & " items"
End If
Find my programs on Softpedia
This might be able to help you:
Code: Select all
Dim item As ListViewItem
For Each item In ListView1.Items
If item.Text.Substring(0,1)=" " Then item.BackColor=Color.Red
Next
comathi wrote:This might be able to help you:How would i do so its those without space that gets colored only ?
Code: Select allDim item As ListViewItem For Each item In ListView1.Items If item.Text.Substring(0,1)=" " Then item.BackColor=Color.Red Next
Simple, just add a Not in front of the IF condition:
Code: Select all
Dim item As ListViewItem
For Each item In ListView1.Items
If Not item.Text.Substring(0,1)=" " Then item.BackColor=Color.Red
Next
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023