Re: ListView item key
From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 03/08/04
- Next message: WStoreyII: "Re: Is it possible to create controls from code"
- Previous message: Julian: "Sortable List Items"
- In reply to: Ken Halter: "Re: ListView item key"
- Next in thread: Ken Halter: "Re: ListView item key"
- Reply: Ken Halter: "Re: ListView item key"
- Reply: Jeff Johnson [MVP: VB]: "Re: ListView item key"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Mar 2004 17:39:02 -0500
Yea, but that's a pretty weak excuse. There's definitely a difference
between a 1 and "1". I venture the implementation of collections themselves
across VB is flawed.
-- Randy Birch MVP Visual Basic http://vbnet.mvps.org/ Please respond only to the newsgroups so all can benefit. "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message news:OmYmdWTBEHA.2484@TK2MSFTNGP12.phx.gbl... : Adding to Bob's reply, the Key's invalid because it's numeric. You can access a ListItem : using its Key or Index. Since the syntax for doing either is exactly the same except for a : number vs a string, the control won't except an entirely numeric value for its Key. If it : did, there'd be know way for it to "know" whether you wanted ListItem(1) as in Index #1 or : ListItem("1") as in Key = "1". Just tack a letter that can't be confused as a number : (don't use E since it can be used for scientific notation) on one side or the other of the : key and you shouldn't have any problems. : : -- : Ken Halter - MS-MVP-VB - http://www.vbsight.com : Please keep it in the groups.. : : : "Enggas" <flam@rdmcorp.com> wrote in message news:eAckGJTBEHA.3472@TK2MSFTNGP09.phx.gbl... : > Hi, : > : > I have a list view control and I need to add item dynamically at run time. : > But I have problem setting the key for every item : > This is what I am doing : : > ============== : > Dim row as ListItem : > For i = 1001 to 1005 : > Set row = ListView.ListItems.Add : > row.Key = CStr( i ) : > Next i : > ============== : > : > When I run the program, it pops up an error message "Invalid Key". : > I've also tried, Set row = ListView.ListItems.Add( , CStr( i ) ), but it : > return the same error message. : > : > I have no clue why the key is invalid, and what should I do to make the key : > become valid. : > : > Anyone can give me some hints? : > : > Any help is appreciated. : > : > -- : > Enggas : > : > "There are two types of people in the world. : > Those that know binary and those that don't" : > : > : :
- Next message: WStoreyII: "Re: Is it possible to create controls from code"
- Previous message: Julian: "Sortable List Items"
- In reply to: Ken Halter: "Re: ListView item key"
- Next in thread: Ken Halter: "Re: ListView item key"
- Reply: Ken Halter: "Re: ListView item key"
- Reply: Jeff Johnson [MVP: VB]: "Re: ListView item key"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|