|
-
Feb 27th, 2001, 04:40 PM
#1
Thread Starter
Member
How can the value of the SelectedItem on a ListView control can be refreshed?
Thank you,
-
Feb 27th, 2001, 04:44 PM
#2
Hyperactive Member
Do you mean:
Code:
lvwList.SelectedItem.Text = "new text"
Achichincle
VB6 (VSEE SP5, W2KPro)
ASP
HTML
-
Feb 27th, 2001, 04:55 PM
#3
Thread Starter
Member
Hi Achichincle,
Thanks for replying. What I mean is I have a loop on how many records on a listview control. It checks if the listitem is selected or not. If it is selected, it gets the current value. However, when I am using this kind of code, it doesn't get the next value. It just gets the first value. Here's my sample program:
With ListViewMetrics.ListItems
For i = 1 To ListViewMetrics.ListItems.Count
If ListViewMetrics.ListItems.Item(i).Selected = True Then
'save the record in database
'MsgBox ListViewMetrics.SelectedItem.Text
sStratID = ListViewMetrics.SelectedItem.SubItems(2) 'Stratification Value
sMetID = ListViewMetrics.SelectedItem.SubItems(3) 'Metric ID
sDashID = ListViewMetrics.SelectedItem.SubItems(4) 'Dashboard ID
End If
Next i
End With
The value of sStratID, sMetID, sDashID is not refreshed with the new selected record in the listview control. What is wrong?
Thank you very much!
-
Feb 27th, 2001, 05:01 PM
#4
Hyperactive Member
I gotcha.
Try:
Code:
sStratID = ListViewMetrics.ListItems(i).SubItems(2) 'Stratification Value
sMetID = ListViewMetrics.ListItems(i).SubItems(3) 'Metric ID
sDashID = ListViewMetrics.ListItems(i).SubItems(4) 'Dashboard ID
The problem is that if you have more than one item selected in the listview it doesn't know which one you're referring to.
I've also noticed that when you load items into a listview their .Selected property seems to be set to True eventhough they don't appear as selected on the listview display.
What I've done is explicitly set the .Selected property to False when I'm loading the listview items in order to avoid this problem.
Hope this helps...
Achichincle
VB6 (VSEE SP5, W2KPro)
ASP
HTML
-
Feb 28th, 2001, 12:36 PM
#5
Thread Starter
Member
Hi Achichincle!
Thank you so much because this works!!!
Have a nice day,
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
|