[SOLVED] PropertyEnumItem index? |
Post Reply |
Author | |
rdeboer
Groupie Joined: 29 April 2004 Location: Netherlands Status: Offline Points: 81 |
Post Options
Thanks(0)
Posted: 06 January 2011 at 4:16pm |
I use code similar like this:
Dim ItemEnum As PropertyGridItem 'Adds a PropertyItemEnum item with a caption of "Enum" and an initial value of 2 'This will cause the constraint with a value of 2 to be selected Set ItemEnum = Category.AddChildItem(PropertyItemEnum, "Enum", 2) 'Adds some constraints along with a Data value ItemEnum.Constraints.Add "Windows 98", 1 ItemEnum.Constraints.Add "Windows 2000", 2 ItemEnum.Constraints.Add "Windows XP", 3 Now while ItemEnum is active, you can read the value of the selected item: Debug.Print "Enum Item Value =" & ItemEnum.Value So far so good. But how do i find this value later in the program? The old VB method would be: Value = cmbBox.ListIndex to find the listindex of the currently selected item. How do i find 'ListIndex' in PropertyGrid? lets say i selected Windows 2000, the listindex would be 2. |
|
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit) Language: Visual Basic 6.0 SP6 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Same ItemEnum.Value will work later.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rdeboer
Groupie Joined: 29 April 2004 Location: Netherlands Status: Offline Points: 81 |
Post Options
Thanks(0)
|
How? I tried:
Set Itemx = AdvancedGrid.FindItem("Enum") If Not (Itemx Is Nothing) Then Debug.Print Itemx.Constraints(Itemx.Value) End If But that gives an error? Excuse my stupidity :) |
|
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit) Language: Visual Basic 6.0 SP6 |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi, Your stupidity is forgiven Constraints collection isn't zero based, first item will start at 1
So if you would add constraint:
and want to get the index of the first item, it will produce an error because there is no constraint with index 0
In this case you have to set Item.value + 1
In this case you have to loop constraints and compare constraint, annoying thing to do (in my opinion...) Best way is to start added constraint with <Data> = 1 and use successive numbers, this way you are able to use Item.Value to "find" selected constraint.
Hope this helps
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
rdeboer
Groupie Joined: 29 April 2004 Location: Netherlands Status: Offline Points: 81 |
Post Options
Thanks(0)
|
Thank you again, Aaron!
|
|
Product: Xtreme Suite Pro (ActiveX) version 11
Platform: Windows XP SP3 (32bit) Language: Visual Basic 6.0 SP6 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |