devxlogo

How can I get the display value of a list box?

How can I get the display value of a list box?

Question:
How can I get the display value of a list box?

Answer:
In Oracle Power Objects, the Value property of the list box isautomatically set to the internal value of the selected entry in thelist box. A list box, or popup list or combo box, also displays avalue, which can be entirely different, depending on the Translationproperty ofthe object.

OPO maintains these two values internally with a two columnrecordset. The first column, with the name DispVal, holds thedisplay value, while the second column, DBVal, holds the actualvalue.

You can use recordset methods to walk through the recordset and findthe row whose second column matches the current Value poroperty ofthe list box. The first column of this row will contain thedisplayed value.

The code to bring up a message box with the display value for a listbox called lstSample is:

DIM objRecSet As ObjectobjRecSet = lstSample.GetRecordset()nPointer = 0DO WHILE nPointer < objRecSet.GetRowCount()       IF objRecSet.GetColVal(2) = lstSample.Value THEN               EXIT DO       ELSE               nPointer = nPointer + 1       END IFLOOPMSGBOX(objRecSet.GetColVal(1))        
See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist