Posted: 02/24/2009 11:38 AM
Hi
Listboxes and Radio Buttons are pretty neat components to have available in the CodeCharge Studio Framework. These two components are very similar on the design side so this one description should cover both.
Start by creating either a listbox or radio button control on you record form (Or convert an existing control to listbox or radio button).
After having done this you will notice in the properties a connection, Data Source Type, Data Source. Set connection to the database connectin you want to use. Set Type to Table/View, and Source to the table you want your listbox or radio button control to use for the next two properties.
The bound colomn property represents the data field in the table that the component will use to fill the field on you form when the corresponding text colomn is selected.
The text colomn is the text that will display on your page for that particular value.
EG:
Bound colomn = 1,2,3
Text colomn = one,two,three
respectively.
Your listbox or radio button component will display on the screen for possible values one two three
When a selection is made the correspondin bound colomn value will be placed into the form field and be entered into your database field specified for that control.
EG: with the above values if ONE is selected the value 1 will be applied to that form field and entered into the database field scpeified for that control at design time.
Next issue is to be able to display the database saved value for that control on another page.
If on all pages in your application that field is represented by the same type contol (ie. listbox or radio button) The control will display just as if it had been selected by a user with the data saved in your database.
However, Listboxes and Radio buttons are only really practical for input fields. If you are only wanting to display the values stored in the database in a regular text field you will need to make some cosiderations.
One method and probably the easiest is to create the bound colomn and text colomn with the same text data. This way the value entered into the database is the same as the text value and when the Database field is displayed in a text field, it will show the text in the control.
If your application requires that the bound data must be different from the text data, you will have to do something different.
The way to do this would be in the text field that is to display the stored listbox or radio button and you want the text to display use a DLookup action in the before show event for the control.
Your Dlookup action should perform a lookup for the container value of the control in the bound colomn and return tghe value of the text colomn. This will cause the text field to display the text value stored in the database for that data on your form.
Hope that helps
Have fun
Joh
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。