Re: ListView item key

From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 03/08/04


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"
: >
: >
:
: 


Relevant Pages

  • Re: why>?
    ... When you hire Excel 'developers' for your own company, ... failure on the part of whoever designed the spreadsheet in question to ... were invalid. ... I've never used this particular error message, but I've used similar, ...
    (microsoft.public.excel)
  • Re: Re-installed Outlook Performs Illegal Operation
    ... > office suite - just the Outlook. ... Search "Explorer caused an invalid page fault in module unknown"; ... The Error Message "Explorer Caused an Invalid Page Fault in Module ...
    (microsoft.public.outlook.installation)
  • Re: rm(1) bug, possibly serious
    ... rm: ../: Invalid argument ... The first time I got an error message, ... Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. ... Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: ...
    (freebsd-stable)
  • Re: How do I temporarily limit values in a query field
    ... I am getting an error message: "The expression you entered has a invalid ..or! ... This is the last few lines of the 'old' sql with an attempt to limit the records to values of <500: ... works fine until I try to put limits on it value in the qryClaimDetails query. ...
    (microsoft.public.access.queries)
  • Re: ListView item key
    ... "Enggas" wrote in message ... > I have a list view control and I need to add item dynamically at run ... > I have no clue why the key is invalid, and what should I do to make ...
    (microsoft.public.vb.controls)