|
-
Jun 23rd, 2004, 09:32 AM
#1
Thread Starter
Lively Member
-
Jun 23rd, 2004, 09:42 AM
#2
Hyperactive Member
Well, I was going to try to fix this but there are too many unknowns...
What is the datatype for TimeLooping
What is the datatype for TempStoreListView3 and what is it's value
What is the datatype for PositionOfTempClient and what is it's value
-
Jun 23rd, 2004, 10:49 AM
#3
And more importantly, what do you mean by "not working"? Error message or unexpected behavior?
-
Jun 23rd, 2004, 01:54 PM
#4
Thread Starter
Lively Member
i cannot help me to highlight the row of the item that i add in
i use the for loop to help me to search which row and column that i need to add in the data in the listview
and after i add in the data, the list view will highlight the row and column that i have addin the data
-
Jun 23rd, 2004, 04:55 PM
#5
New Member
For TempLooping = 0 To TempStoreListview3 - 1
If ListView3.Items(TempLooping).SubItems(1).Text.Equals(Year_ComboBox.Text) Then
ListView3.Items(TempLooping).SubItems(PositionOfTempClient).BackColor = Color.Cyan
End If
Next
I dont know but it looks like you're only testing one subitem. Take a look at your If statement, shouldn't it be:
If ListView3.Items(TempLooping).SubItems(PositionOfTempClient).Text.Equals(Year_ComboBox.Text) Then
instead of SubItems(1) ?
-
Jun 23rd, 2004, 08:01 PM
#6
Fanatic Member
i think this is what you are looking for.
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New SqlConnection()
cn.ConnectionString = "integrated security=true;initial catalog=northwind"
cn.Open()
Dim cmdtext As String = "select * from categories"
Dim cm As New SqlCommand(cmdtext, cn)
Dim dr As SqlDataReader = cm.ExecuteReader
Dim i As Integer = 0
While dr.Read
ListView1.Items.Add(dr.GetValue(0))
ListView1.Items(i).SubItems.Add(dr.GetValue(1))
ListView1.Items(i).SubItems.Add(dr.GetValue(2))
i += 1
End While
brown_monkey_look("Cheeses")
End Sub
Sub brown_monkey_look(ByVal s As String)
Dim i As Integer
For i = 0 To ListView1.Items.Count - 1
Dim li As ListViewItem = ListView1.Items(i)
li.UseItemStyleForSubItems = False
Dim si As ListViewItem.ListViewSubItem
For Each si In li.SubItems
If si.Text.Equals(s) Then
si.BackColor = Color.Brown ' monkey
End If
Next
Next
End Sub
hope i don't bark the wrong tree. though monkeys don't bark...
-
Jun 23rd, 2004, 08:03 PM
#7
Hyperactive Member
That's some pretty creative coding, how did you gleen all that from the information provided in these posts??
-
Jun 23rd, 2004, 08:20 PM
#8
Fanatic Member
he said highlighting subitem???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|