Print Page | Close Window

ItemData for Listbox

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13995
Printed Date: 22 November 2024 at 10:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ItemData for Listbox
Posted By: tobi
Subject: ItemData for Listbox
Date Posted: 13 April 2009 at 10:21am
Hi,

in my c# application I want to add items to the CJ Listbox and then set something like Tag or ItemData to the
corresponding database ID ...

I think ItemData is the right thing, but how can I set it after or while adding a new item ?

Thanks



Replies:
Posted By: jpbro
Date Posted: 13 April 2009 at 10:30am
You should use the NewIndex property for the ItemData index parameter immediately after you add the new item using the AddItem method. In VB6 your code would look like this:


For i = 0 to 9
   Me.ComboBox1.AddItem "Test" & i
   Me.ComboBox1.ItemData(Me.ComboBox1.NewIndex) = i
Next i


You should be able to infer the C# code from that. (This code sets the ItemData property for each newly added item to the value in the counter "i", you wuold change that to be your database index #).


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: tobi
Date Posted: 13 April 2009 at 11:42am
In c# and with ListBox the ItemData method is not listed in context menu ???


Posted By: jpbro
Date Posted: 13 April 2009 at 8:54pm
I see the ItemData property in VB6 with version 13.0.0. What version of the suite controls are you using?

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Oleg
Date Posted: 14 April 2009 at 12:47am
Hi,
 
.NET renames it to set_ItemData:
 
axListBox1.set_ItemData(...)


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net