No QuickReports
The reason for this problem is that the Quickrpt.dcuil unit referenced by Custrpt.PAS unit cannot be found: QuickReport for .NET is not included in Delphi 2005, the recommended upgrade this feature is to use the RAVE report in this example. Or look for QuickReports The corresponding .net version, or other report frameworks instead.
The report sections will be further modified by the readers who are interested, but in this, we still have to make the project can be added - even if there is no report function.
Operating Menu Project | View Source To open the project file mastapp.dpr, and find the QuickReports unit in the USES clause (there should be a few lines to reference the TQUickRep type), remove these lines, as shown below:
uses Forms, Main in 'MAIN.PAS' {MainForm}, Brparts in 'BRPARTS.PAS' {BrPartsForm}, QryCust in 'QryCust.pas' {QueryCustDlg}, Edparts in' EDPARTS.PAS '{EdPartsForm}, BrCstOrd in' BrCstOrd.pas' {BrCustOrdForm}, Edcust in 'EDCUST.PAS' {EdCustForm}, Edorders in 'EDORDERS.PAS' {EdOrderForm}, SrchDlg in 'SrchDlg.pas' {SearchDlg}, Splash in' SPLASH.PAS '{SplashForm }, Pickdate in 'PICKDATE.PAS' {BrDateForm}, About in 'ABOUT.PAS' {AboutBox}, Pickrep in 'PICKREP.PAS' {PickRpt}, // CustRpt in 'CustRpt.pas' {CustomerByInvoiceReport: TQuickRep}, // OrderRpt in 'OrderRpt.pas' {OrdersByDateReport: TQuickRep}, // InvcRpt in 'InvcRpt.pas' {InvoiceByOrderNoReport: TQuickRep}, PickInvc in 'PickInvc.pas' {PickOrderNoDlg}, DataMod in 'DataMod.pas' {MastData : TdataModule};
A quick way to mark the source code as a comment is to press CTRL / key. This shortcut key is to mark a normal code as a comment, then move the cursor to the next line. Use this method, you can quickly The marking marks are comment lines.
* Note that you can also select a block of code composed in both lines, then press Ctrl / to mark the entire block as a comment.
Move to the bottom of the code of the project file, and locate the three Createform declarations that create a QuickReports form, while selecting this three lines, press Ctrl / to mark the comment line, the results are as follows:
begin Application.Initialize; SplashForm: = TSplashForm.Create (Application); SplashForm.Show; SplashForm.Update; Application.Title: = 'Marine Adventures Order Entry'; Application.HelpFile: = 'MASTAPP.HLP'; Application.CreateForm ( TMainForm, MainForm); Application.CreateForm (TBrPartsForm, BrPartsForm); Application.CreateForm (TQueryCustDlg, QueryCustDlg); Application.CreateForm (TEdPartsForm, EdPartsForm); Application.CreateForm (TBrCustOrdForm, BrCustOrdForm); Application.CreateForm (TEdCustForm, EdCustForm); Application.CreateForm (TEdOrderForm, EdOrderForm); Application.CreateForm (TSearchDlg, SearchDlg); Application.CreateForm (TBrDateForm, BrDateForm); Application.CreateForm (TAboutBox, AboutBox); Application.CreateForm (TPickRpt, PickRpt); // Application.CreateForm (TCustomerByInvoiceReport, CustomerByInvoiceReport); // Application.CreateForm (TOrdersByDateReport, OrdersByDateReport); // Application.CreateForm (TInvoiceByOrderNoReport, InvoiceByOrderNoReport); Application.Cre Ateform (TPICKORDERNODLG, Pickordernodlg); Application.createform (TMastData, Mastdata); splashform.hide; splashform.free; application.run; end. This is still not completed, because in other places in the program, there are QuickReports. All related rows are needed and commented away.
Execute menu Search | Find IN Files, find Custrpt (USES of other units), you must remove them)
Delphi 2005 Find File Dialog
* Note that we can group the results of the field, the files that are found will be displayed in another new TreeView. Finally, open the main.pas unit.
Open file main.pas, check the USES clause in the Implementation section, which also contains a Custrpt unit.
* Note that in the error INSIGHT will automatically mark these problems, as the Orderrpt and InvCrpt units are not available, they will be identified (the sector cannot explain the corresponding unit name)
Unable to explain Unit name - display other could not be documented
Use Ctrl / will be referenced to Custrpt, Orderrpt, and INVCRPT unit code notes
Press SHIFT F2 to save all files of the project, then press SHIFT F9 to re-establish the project
The next error will appear in the PrintCustomerReport method.
Select the code in the PrintCustomerReport method and mark all of them as a comment. As shown below (you can choose to have a few lines or fewer comments, there is no effect) ProcedureTMainform.PrintCustomerReport (preview: boolean); begin with mastdata.custbylastinvQuery DO Begin Open; // if preview damort.preview // else // CustomerbyInvoiceReport.print; close; end;
The next question is that in the printorderReport method, it must also be annotated.
Select the code of the PrintOrderReport method, press Ctrl / to mark all selected code as a comment, as follows:
Note PrintOrderReport method
Now there is a place to leave a place: PrintInvoiceReport
Select the code in the PrintInvoiceReport method, identify it as a comment, as shown below (you can freely select multiple rows or less words)
Procedure TMAINFORM.PRINTINVOICEREPORT (Preview: Boolean);
Begin
IF pickordernodlg.showmodal = mrok dam
// if preview kilnoreport.preview // else // InvoiceByOrdernoreport.print
END;
Press SHIFT F2 to save all files of the project, then press SHIFT F9 to re-establish the project
This time, the project may not have a problem by adding and linking.
Database path
There are still some places to be wrapped in this package. If you are now trying to run the program, the program may be able to run, but it is also possible that you will get a prompt information where you cannot locate the database.
This error is actually caused by the code of the program itself. In the data module, there is a function DataDirectory, as follows:
Function TMastData.DataDirectory: String;
Begin
{Assume Data is in ../../../../../common files / borland shared / data / data relative to where we are}
Result: = ExtractFilePath (paramstr (0));
// Result: = expandFileName (Result '../../data/');
Result: = expandFileName (Result '../../../../common files / borland shared / data /');
END;
Just as indicated in the comment, it assumes that the path where the data is located in the path to itself. The original Demo directory may be right, but it is not important in the program we will be distributed now.
In fact, when we start transplanting this project, we confirm that the data control can be coupled to the database at design time, so Database.DatabaseName has pointed to the correct position.
DataDirectory is only available in one place: MastDataCreate method. We must undo in this thing.
Cut Datamod.PAS unit and position it to the MastDataCreate method, confirm that the correct value gives DataBase.DatabaseName, overrides the value of the point DataDirectory, as follows:
procedure TMastData.MastDataCreate (Sender: TObject); var DataFile: string; begin DataFile: = DataDirectory 'MASTSQL.GDB'; DataFile: = Database.DatabaseName; // already working at design-time if not FileExists (DataFile) then! if MessageDlg ( 'Could not locate MASTSQL.GDB. Would you like to locate the file?', mtError, [mbYes, mbNo], 0) = mrYes then if OpenDialog.Execute then begin if UpperCase (ExtractFileName (OpenDialog.FileName)) = 'MASTSQL.GDB' then DataFile: = OpenDialog.FileName else raise Exception.Create ( 'Invalid File:' OpenDialog.FileName); end else raise Exception.Create ( 'Can not locate Interbase data file: MASTSQL.GDB'); Database.DatabaseName: = DataFile; Database.Open; Transaction.StartTransAction; End; * Note that you can also remove the code of the Call DataDirectory method, but you still need to give a new value to DataFile.
Press SHIFT F2 to save all files in the project
Running a nautical adventure activity
Press SHIFT F9 to re-edit the heavy project.
The project can still be used by the designation of the login procedure by finishing and running, as shown below:
Nautical Adventure Campaign
Click the button new Order to enter the order form Order Form:
Order form (Order Form)
Close order form
(
Order Form
)
And click the button
Browse
Come to the customer order form
(
ORDERS by Customer Form
):
Customer ordering form
(
ORDERS by Customer Form
)
Turn off the customer order form (ORDERS BY CUSTOMER FORM), click the button parts to open the browse parts form:
Browse department form
(
Browse Parts Form
)
Close Browse Parts Form, and, if you are not running over the upgraded Delphi 2005, click the button Reports to open the report Selection Form:
Report Select Form (Report Selection Form)
* Note that the three reports are not available - the relevant buttons don't work - because we will use all the code to QuickReports, there is also a report form comment. You can add the report part yourself.
to sum up
In this tutorial, we demonstrate how to use Delphi 2005 to transplant a VCL for .NET under .NET. We started with an example threading first, first upgrade to unsafe .NET programs Then further turn it into a 100% secure .NET local program. Next, we used a more complex and use the database.
Want to transplant the VCL program under Win32 to .NET, what you need is far more simply just to re-establish the code code. Delphi 2005 provides a lot of transplant to .NET help, you can protect us in Win32 application development The investment. (Full text)