February 11, 2005

xiaoxiao2021-03-06  41

A problem that the original software is found: 1 Cannot be fuzzy to the disc name; 2 can only view a user in one in the settlement section; 3 report functions are too weak; 4 do not understand [user return] - [Check up] What is it? Use; (resolved) Write the fee into the "Income Information Table"; 5 [Administrator Information Maintenance] Always there is no reaction; (resolved) is not no response, it is the software setting problem, only the first number of administrators In order to "add", "modify", and "delete" for administrators, and other administrators have no right to operate this page. II Solved Problems: 1 CD type can only display the letter code without displaying the text: Delphi's DBGRID drop-down list and find field programming method data grid is a very popular data input and display form, like everyone familiar with Excel, Powerful brows, etc. in VFP, etc., for the majority of programmers. When using the Delphi development database application system, use the data grid DBGRID to enter the data, some fields only allow for a few fixed strings, such as the storage period of the archives, only "permanent", "long-term" and "short-term" three Can you choose from a drop-down list, which is convenient to input and avoid input errors? There are also some fields, such as unit numbers in the employee information library (more detailed information in additional unit libraries), when entering and displaying employee data, can be operated without the unit number, alternative to more intuitive What about the unit name in the unit library? The answer is affirmative, Delphi's data grid control DBGRID, supports the drop-down list and finding the field programming, and the programmed process is visual, and does not need to write a row statement. The drop-down list in DBGRID implements the drop-down list in the DBGRID grid, sets the Picklist string list of this field in the DBGRID, and the initial number value DropdownRows can be. Taking the origin field (string type) in the staff information library as an example, the specific design steps are as follows: 1. Place Table1, DataSource1, DBGRID1, DBNAVIGATOR1, etc. on the form, press the table to set the properties of each object:

------------------------------------------------------ -------------------------------- Table1 Database Sy1 Table Zgk.dbf file: // Staff Information Library Datasource1 Dataset Table1DBGRID1 DataSource Datasource1dbnavigator1 DataSource DataSource1 ------------------------------------------ 2, double click Table1, in the pop-up FORM1.TABLE1 window, use the right-click to pop up the shortcut menu, click the Add Fields menu item; after selecting all the fields, press the OK button.

3. Modify the DISPLAYLABEL attribute of step 2's new field. Take the table1zgbh field as an example, select Table1zGBH in the Object Inspector window, modify the property DisplayLabel = employee number, and the remaining fields are similar.

4. Double-click DBGRID1. In the pop-up DBGRID1.COLUMNS window, click the Add All Fields button to increase all fields of Table1.

5, in the Editing DBGRID1.COLUMNS window, select JG this line, switch to the Object Inspector window, modify its picklist.strings as "Hubei Zhijiang City (Renewal) Beijing (Renewal) Henan Pingdingshan City (Renewal) Zhejiang Deqing City 6. Write a statement in the Form1.onCreate event:

Table1.open;

7, F9 runs, click on a recorded born field with the mouse, and a button appears on the right, click this button to display a drop-down list, including the four rows of strings entered in step 5, and can be selected with the mouse. Of course, you can also enter a string in the drop-down list. Finding fields in DBGRID The so-called lookup field (the value of a key field in DBGRID is derived from the corresponding field of another database. Using Find field technology, not only can effectively avoid input errors, but also DBGRID's display mode is more flexible, and the key fields are not displayed, and the data of another field corresponding to the source database is displayed. ---- For example, we display and edit employee information in dBGrid, including employee numbers, employee names, origin, unit numbers, and unit numbers from another database table - unit library, called "unit number" Field. If we directly display and edit the unit number, it will face 1, 2, 3, etc., very intuitive numbers, and the editor is extremely easy to go wrong. But if the display and editing is the corresponding unit name in the unit library, it will be very intuitive. This is the benefit of the supported find field supported by DBGRID.

Realizing the search field of DBGRID does not require any statement, the specific design steps are as follows: 1. Place Table1, Table2, DataSource1, DBGRID1, DBNAVIGATOR1, etc. on the form, press the table to set the properties of each object:

------------------------------------------------------ -------------------------------- Table1 Database Sy1 Table Zgk.dbf file: // Staff Information Library Table2 Database SY1 Table dwk.dbf file: // unit information library DataSource1 DataSet table1dbgrid1 DataSource Datasource1dbnavigator1 Datasource DataSource1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---------- 2, double-click Table1, in the pop-up FORM1.TABLE1 window, use the right-click to pop up the shortcut menu, click the Add Fields menu item; after selecting all the fields, press the OK button.

3. Modify the DISPLAYLABEL attribute of step 2's new field. Take the table1zgbh field as an example, select Table1zGBH in the Object Inspector window, modify the property DisplayLabel = employee number, and the remaining fields are similar.

4, set table1dwbh.visible = false.

5, in the Form1.Table1 window, use the right-click to pop up the shortcut menu, click the New Field menu item, add a lookup field DWMC, set the corresponding properties in the pop-up window, press the OK button to confirm; in the Object Inspector window, set Table1DWMC. DisplayLabel = Unit name. 6. Write a statement in the Form1.onCreate event:

Table1.open;

7. Press F9 to run, when the light is shifted to a recorded unit name field, click on the field with the mouse, that is, a drop-down list, click the lower arrow on the right, and select it in the drop-down list. It can be seen here that the contents of the drop-down list come from the unit library and cannot enter other content. The drop-down list and find fields in dbgrid Although the drop-down list and lookup fields in DBGRID are all in the form of the following list, but both have a big difference. 1. Use the drop-down list set by the PickList property, which is manually entered, although it can also be modified in the program, but the dynamic characteristics clearly extract data directly by different database tables.

转载请注明原文地址:https://www.9cbs.com/read-58901.html

New Post(0)