JawwadLone
Programmer
I am using ListView Control in Visual Basic 6.0. I want to change the color of selected row in listview. I have used this code to change the color of selected listview item
ListView1.SelectedItem.ForeColor = vbGreen
But this code only changes the color of listview item. I want to change the color of complete row. Is it possible or not?
Another thing I want to know is, I am using a textbox to make entries in listview control. My textbox is placed beside the listview control. Is there any way i can move my textbox on anyparticular subitem in listview control and set the size of the textbox according to that particular subitem? I would be very thankfull, if any one solve my problem.
I am using this code in KeyDown event of textbox
If (KeyCode >= 48 And KeyCode <= 56) Or KeyCode = 45 Then Exit Sub
If KeyCode = 13 Or KeyCode = 40 Then 'Down Arrow
ls.SubItems(2) = Val(Text1.Text)
If rec < lsCount Then
ls.ForeColor = vbBlack
rec = rec + 1
Set ls = ListView1.ListItems.Item(rec)
ls.ForeColor = vbGreen
Text1.Text = ls.SubItems(2)
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
ElseIf KeyCode = 38 Then 'Up Arrow
ls.SubItems(2) = Val(Text1.Text)
If rec > 1 Then
ls.ForeColor = vbBlack
rec = rec - 1
Set ls = ListView1.ListItems.Item(rec)
ls.ForeColor = vbGreen
Text1.Text = ls.SubItems(2)
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
End If
ListView1.SelectedItem.ForeColor = vbGreen
But this code only changes the color of listview item. I want to change the color of complete row. Is it possible or not?
Another thing I want to know is, I am using a textbox to make entries in listview control. My textbox is placed beside the listview control. Is there any way i can move my textbox on anyparticular subitem in listview control and set the size of the textbox according to that particular subitem? I would be very thankfull, if any one solve my problem.
I am using this code in KeyDown event of textbox
If (KeyCode >= 48 And KeyCode <= 56) Or KeyCode = 45 Then Exit Sub
If KeyCode = 13 Or KeyCode = 40 Then 'Down Arrow
ls.SubItems(2) = Val(Text1.Text)
If rec < lsCount Then
ls.ForeColor = vbBlack
rec = rec + 1
Set ls = ListView1.ListItems.Item(rec)
ls.ForeColor = vbGreen
Text1.Text = ls.SubItems(2)
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
ElseIf KeyCode = 38 Then 'Up Arrow
ls.SubItems(2) = Val(Text1.Text)
If rec > 1 Then
ls.ForeColor = vbBlack
rec = rec - 1
Set ls = ListView1.ListItems.Item(rec)
ls.ForeColor = vbGreen
Text1.Text = ls.SubItems(2)
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
End If