Nimmi

You are in luck.  I built a custom method to do just this.
Pass the method the name of the item (your combo box) and it will return
the label for the entry the user selected.

If you have any questions, please let me know.
Bob Eovine
General Cinema
[EMAIL PROTECTED]


        public String getListItemLabel(String sListItemName)
        {

//-------------------------------------------------------------
                // getListItemLabel(String sListItemName)

//-------------------------------------------------------------
                // DESCRIPTION:
                // THIS METHOD WILL TAKE THE PASSED LIST ITEM NAME (THE
NAME OF
                // A VISUAL OBJECT ON THE PAGE) AND GET THE COMBO/LIST
BOX'S CURRENTLY
                // SELECTED LABEL.  FOR EXAMPLE, IF I AM WORKING WITH
THE SHOW TYPE 
                // COMBO BOX AND THE REGULAR FEATURE SHOW TYPE IS
SELECTED, THEN WHEN
                // I GET THE DISPLAY FIELD VALUE, I SHOULD GET 1.  WHEN
THE METHOD GETS THE 
                // CURRENTLY SELECTED VALUE'S LABEL, IT SHOULD RECEIVE
REGULAR FEATURE.
                // AUTHOR:  B.EOVINE
                // DATE:    6/04/99

//------------------------------------------------------------- 

                // CREATE A STRING TO HOLD THE LABEL FOR THE CURRENTLY
SELECTED ITEM
                String sLabel = new String("");
                
                // GET A HANDLE ON THE CURRENT COMBO BOX PASSED TO THE
METHOD
                CSpComboBox cmCurrComboBox      = (CSpComboBox)
getDisplayField(sListItemName); 

                // GET THE CURRENTLY SELECTED ROW
                CSpListItem currSelected        = (CSpListItem)
cmCurrComboBox.getSelected(); 

                // IF IT ISN'T NULL, GET THE LABEL FOR THE ROW
                if (currSelected != null) 
                        sLabel = currSelected.getLabel(); 
                
                // RETURN THE ROW LABEL
                return(sLabel);

        } // END CUSTOM METHOD getListItemLabel(String sListItemName)

-----Original Message-----
From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 03, 1999 11:24 AM
To: 'NetDynamics'
Subject: [ND] Get the label of the selected item in the Combobox


I have a combobox based on a dataobject where column1 is the value of
the
item and column2 is the label displayed for that item in the combobox.

I want to get both the value and the label of the selected item. The
value I
can get by:
getDisplayFieldValue("ComboBox1").

How can I get the label of the selected item? 

I hope there is a straight way to do this otherwise I will have to
change my
combobox's value to contain both column1 and column2 and then extract
the
two from the selected item value.

Thanks.

-Nimmi Shamdasani
Motorola Manufacturing Systems
1299 E. Algonquin Road,
Schaumburg, IL 60196


________________________________________________________________________
_

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to:
http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to