-
Apr 29th, 2014, 08:58 AM
#1
Thread Starter
Enjoy the moment
[RESOLVED] key is not unique in collection and some other errors
i am trying to add a icon to my listview based and some example i see but i get all kind of errors
or sometimes it dosnt even display the first subitem in the listview need some help please
this is from the example
Code:
ListViewIcons.ListItems.Add , , "Settings", 1
ListViewIcons.Icons.LoadBitmap App.Path & "\Icons\AlphaSettings.bmp", 1, xtpImageNormal
XtremeSuiteControls.Icons.LoadBitmap App.Path & "\Icons\AlphaSettings.bmp", 1,xtpImageNormal
this is what i am trying to do
Code:
LsVw.ColumnHeaders.Add , , "Customer Name", 1500
LsVw.ColumnHeaders.Add , , "Address", 1500
Set rs = CN.Execute("SELECT * FROM Customers ORDER BY ID")
While Not rs.EOf
Set itm = LsVw.ListItems.Add(1, , rs!FullName)
itm.Tag = rs!Id
itm.SubItems(1) = rs!Address
XtremeSuiteControls.Icons.LoadIcon App.Path & "\Icons\AlphaSettings.bmp", 1, xtpImageNormal
LsVw.Icons.LoadIcon App.Path & "\Icons\AlphaSettings.bmp", 1, xtpImageNormal
i tried everything dont know what to do to add this icon
Code:
Set itm = LsVw.ListItems.Add(, 1, rs!FullName) ' here i get key is not unique in collection
Set itm = LsVw.ListItems.Add(rs!FullName, , 1) 'here i see in the listview all [1]
Set itm = LsVw.ListItems.Add(, , rs!FullName, , "1") ' here i get wrong numbers of arguments
i am lost
any help will be appreciated
salsa31
-
Apr 29th, 2014, 09:14 AM
#2
Re: key is not unique in collection and some other errors
When you use 3rd party controls that almost nobody else has it gets very hard to answer your questions. The proper place would be the 3rd party vendor's support forums.
-
Apr 29th, 2014, 09:56 AM
#3
Thread Starter
Enjoy the moment
Re: key is not unique in collection and some other errors
is the e.x in post #1 first code dosnt help?
there vendor's support takes ages
-
Apr 29th, 2014, 10:10 AM
#4
Re: key is not unique in collection and some other errors
The example seems rather odd. You add the item first then add the icon to the list and then add it to the control suite [whatever that is] seems backwards to me.
For a normal list view you would use an image list, add the images/icons to that first and then when you add an item to the list you specify the index of the image that you want to add.
This is a problem with 3rd party controls. Hard for people to help if they don't use the same control. I generally try to avoid them when ever possible with the exception of Active Reports which I use in every project that needs reporting.
-
Apr 29th, 2014, 10:44 AM
#5
Thread Starter
Enjoy the moment
Re: key is not unique in collection and some other errors
i know sir
the normal listview is easy to add and its free
i paid money for this active x control, and to understand the logic sometimes not easy
i know you are very experienced with programming
maybe you can try to give me a advice or a sample of your logic
how to accomplish this?
any thing will be find
-
Apr 29th, 2014, 10:45 AM
#6
Thread Starter
Enjoy the moment
Re: key is not unique in collection and some other errors
BTW what is key is not unique in collection?
-
Apr 29th, 2014, 10:48 AM
#7
Re: key is not unique in collection and some other errors
The ListView takes four parameters: Index, Key, Text, and IconID (in that order).
If 1 is your icon ID, and rs!FullName is your text, then you should call it like this:
Code:
Set itm = LsVw.ListItems.Add(, , rs!FullName, 1)
-
Apr 29th, 2014, 10:50 AM
#8
Re: key is not unique in collection and some other errors
RE: key is not unique in collection
You were trying to set the Key parameter to 1 more than once, hence the error. Keys must be unique (that is, not repeated for multiple items - 1 key=1 item) so that you can reference a single item by it's key.
-
Apr 30th, 2014, 12:01 AM
#9
Thread Starter
Enjoy the moment
Re: key is not unique in collection and some other errors
tnx jpbro i tried you method dosnt display nothing
ill send them agin a email for thie issue
-
Apr 30th, 2014, 12:49 AM
#10
Re: [RESOLVED] key is not unique in collection and some other errors
Based on the sample this line
Code:
Set itm = LsVw.ListItems.Add(1, , rs!FullName)
Should be
Code:
Set itm = LsVw.ListItems.Add(, , rs!FullName,1)
also this line
Code:
LsVw.Icons.LoadIcon App.Path & "\Icons\AlphaSettings.bmp", 1, xtpImageNormal
In the example uses LoadBitmap rather than load icon and it is a bmp that you are loading so you might want to do it like it is in the example.
Last edited by DataMiser; Apr 30th, 2014 at 12:53 AM.
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
|