Dropdown how to access not current selected item text

Add-in Express™ Support Service
That's what is more important than anything else

Dropdown how to access not current selected item text
 
Matt Driver


Matt


Posts: 152
Joined: 2004-08-17
Hi

I have the following issues. For the last 18 months I have been accessing a dropdown using code:

if Left(AdxCmdBarDropDwn_Ex.Item(IntCounter - 1), 8) = "Contact" then

This generates an exception in Adx.

I have re-written this to be:

if Left(AdxCmdBarDropDwn_Ex.items.item(IntCounter - 1), 8) = "Contact" then

This works but the first line of code used to work I believe!

What should I use to access the text of the non active/visible indexed item in a drop down.

Matt
Posted 19 Jul, 2006 10:23:41 Top
Matt Driver


Matt


Posts: 152
Joined: 2004-08-17
Hi

I have this in debug mode:

?Left(AdxCmdBarDrpDwn_EX.Items.Item(Intcounter - 1), 8)
"Lead: 26"
?Left(AdxCmdBarDrpDwn_EX.Item(Intcounter - 1), 8)
Run-time exception thrown : System.Runtime.InteropServices.COMException - Member not found.

It clearly shows using the first line generates and exception. I do use this method of getting the selected text elsewhere in my code so what is the difference between the two calls inside ADX ?

Matt
Posted 19 Jul, 2006 10:34:16 Top
Sergey Grischenko


Add-in Express team


Posts: 7225
Joined: 2004-07-05
Matt,

in VB.NET:
MsgBox("The Currect Item: " + AdxCommandBarDropDownList1.Items.Item(AdxCommandBarDropDownList1.ListIndex - 1))
MsgBox("The First Item: " + AdxCommandBarDropDownList1.Items.Item(0))
MsgBox("The Last Item: " + AdxCommandBarDropDownList1.Items.Item(AdxCommandBarDropDownList1.ListCount - 1))

in C#:
MessageBox.Show("The Currect Item: " + adxCommandBarDropDownList1.Items[adxCommandBarDropDownList1.ListIndex - 1]);
MessageBox.Show("The First Item: " + adxCommandBarDropDownList1.Items[0]);
MessageBox.Show("The Last Item: " + adxCommandBarDropDownList1.Items[adxCommandBarDropDownList1.ListCount - 1]);
Posted 19 Jul, 2006 11:07:48 Top
Matt Driver


Matt


Posts: 152
Joined: 2004-08-17
Thanks I will update code.

Matt
Posted 19 Jul, 2006 11:31:42 Top