|
-
Nov 3rd, 1999, 07:13 AM
#1
Thread Starter
New Member
I'm having two problems. First, I want to use the Key property to store a database ID number for each record I load into the listview control. Even if I use the CStr() function to convert the ID number to a string, I get an "Invalid Key" error. Second, how do I get the program to know which listitem the user has clicked on? Thanks.
-
Nov 3rd, 1999, 11:59 AM
#2
Lively Member
Use ItemData property of the listbox control. It allows u to store id of the string that will be displayed in the listbox at run time.
and when u want to retrieve this values for the selected list item use the same ItemData property with the ListIndex Property of listbox, that returns the index values of the currently selected item.
Thanx Manish
-
Nov 3rd, 1999, 08:41 PM
#3
Instead of Key property use Tag property. It exepts any string value.
For your second question:
Code:
Option Explicit
Private m_ListItem As ListItem
Private Sub ListView1_Click()
MsgBox "You have selected " & m_ListItem.Text
End Sub
Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Set m_ListItem = Item
End Sub
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
[This message has been edited by Serge (edited 11-04-1999).]
-
Feb 16th, 2000, 06:37 AM
#4
New Member
Have you found an answer for this one? I am having the same problem with key values that start with zeros.
Originally posted by ktippetts:
I'm having two problems. First, I want to use the Key property to store a database ID number for each record I load into the listview control. Even if I use the CStr() function to convert the ID number to a string, I get an "Invalid Key" error. Second, how do I get the program to know which listitem the user has clicked on? Thanks.
-
Feb 16th, 2000, 08:49 AM
#5
Addicted Member
Even if you use CSTR to change to a string, you still need to have a non-numeric included in it. Yes it is a pain, but it is required.
-
Feb 16th, 2000, 09:00 AM
#6
Member
Originally posted by HDR:
Even if you use CSTR to change to a string, you still need to have a non-numeric included in it. Yes it is a pain, but it is required.
I think it will work with a completely numeric string, but the problem is when the numeric string has leading zeroes. It will work with "12345" but not with "012345" this is very strange. Any idea why it works like this? Any idea where some MS documentation may be located regarding this?
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
|