How can I dynamically add or delete entries from a list box?

How can I dynamically add or delete entries from a list box?

How can I dynamically add or delete entries from a list box, popuplist or combo box?

List boxes, popup lists and combo boxes all use the Translationproperty. The Translation property gives all of these list-typeobjects the ability to display one value to the user while using adifferent value for the selection. For instance, a combo box coulddisplay the name of an employee, while the actual Value property isthe employee’s identification number.

You can set the display and internal values for a list-type object byassigning database columns for the display and internal values, byassigning an SQL statement to the Translation property that returns acolumn for the display and internal values, or by creating a textlist where the display value and the internal value are each listedon a separate line with an “=” sign between them, as illustratedbelow.

Aaron = A
Bobby = B
Cathy = C

The techniques described below allow you to add entries or deleteentries from list-type objects that use a value list in theTranslation property.

To dynamically add entries to a list-type object, you can dynamicallyreset the Translation property of the object. In the code examplebelow, the display value, represented by the vsDisplay variable, the”=” sign and the internal value, represented by vsValue, areconcatenated onto the end of the Translation property for thelstSample list box.

DIM sNewLine As StringsNewLine = CHR(13) & CHR(10)lstSample.Translation = lstTranslation & sNewLine & &       vsDisplay & "=" & vsValue     

Before the values are added to the Translation property, a new linecharacter and a carriage return character are added to the end of theproperty to indicate a new entry is about to begin. The CHR()function assigns the value of the ASCII character for the charactersto the sNewLine variable, which is added to the Translation propertybefore the new values.

Setting the Translation property will cause the list-type object toautomatically re-populate itself.

You can also use string manipulation methods to delete values fromthe Translation property. You would find the current Value of thelist-type object in the Translation string, find the followingthe value, find the preceding the value and then reconstruct theproperty without the entry for the value.

Note: In version 1 of Oracle Power Objects, a bug causes a list boxto not completely clear a list box once you delete the final entry inthe Translation property.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several