Hi
Ive got a terrible problem that I hope someone can help me with. When I try run my program I get a //[Error] Rlink32: Unsupported 16bit resource in file {"my fil name.dfm"}. I searched on the web for an answer, but the ones I found were not exactely what I wanted. The only thing I did was change the form and code a little and then the error occured when i tried to run it or to complile it. I thought I my have change a file by accident, so I ran a backup unchanged copy form another computer, which works on that computer, but when I ran it in delphi it ave me the same error.
I am using multiply forms and it complains only about one or two. I tried restarting delphi and my computer, both didn't work and tried my other computer where it gives the same error. When it attempts to open one form it gives me the error // Error creating form: Invalid binery value on line 17997//. I have no idea what that means and when I press OK it complains while opening another for with the error //Error creating form: Invalid binery value on line 2008//. Of coarse I still can view the code and form, and the syntex is even correct.
Could anyone tell me how to solve this problem as I really need to carry on with my program.
Thanks
Directly editing a .dfm file is VERY dangerous. It's possible you are using a 16bit component. Without seeing the code, it will be hard to help further, however.
Hi
This is my code. It is only the base one as you can see through the repetition. I tried in the mean time to change the random numbers back to the original which is //(20)// but the it gives the Rlink error of the possition of the file eg:// Cocumentsandsettings... filename//. Forgive me for not editing the code so that you can understand what is going on in more detail, but contact me it you need a better explaination.
Ihope this helps.Code://unit assignment4_MDJ_u; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls; type TfrmIntermediate = class(TForm) imgBackRound: TImage; imgWrong: TImage; imgCorrect: TImage; lblTime: TLabel; gbMultiply: TGroupBox; lbltotalcomple: TLabel; BitBtnMultiply: TBitBtn; gbAdd: TGroupBox; lblTotalcomp: TLabel; BitBtnAdd: TBitBtn; gbSubtract: TGroupBox; lbltotalcompl: TLabel; BitBtnSubtract: TBitBtn; gbDivide: TGroupBox; lbltotalcomplet: TLabel; BitBtnDivide: TBitBtn; gbChoice2: TGroupBox; btnAdd: TButton; btnMutiply: TButton; btnSubtraction: TButton; btnDivide: TButton; BitBtnCancel: TBitBtn; BitBtnBack: TBitBtn; pnlClosePage: TPanel; lblExit: TLabel; ImgSad: TImage; BitBtnNo: TBitBtn; BitBtnYes: TBitBtn; bmbScores: TBitBtn; gbPlayer: TGroupBox; lblPlayer: TLabel; bmbplayer1: TBitBtn; bmbPlayer2: TBitBtn; bmbplayer3: TBitBtn; bmbplayer4: TBitBtn; bmbplayer5: TBitBtn; bmbplayer6: TBitBtn; PnlTotalans: TPanel; lblTotalwrong: TLabel; lblTotalCorr: TLabel; lblTotal: TLabel; pnl1: TPanel; lbl1: TLabel; lbl2: TLabel; lbl3: TLabel; pnl3: TPanel; lbl7: TLabel; lbl8: TLabel; lbl9: TLabel; pnl5: TPanel; lbl13: TLabel; lbl14: TLabel; lbl15: TLabel; pnl2: TPanel; lbl4: TLabel; lbl5: TLabel; lbl6: TLabel; pnl4: TPanel; lbl10: TLabel; lbl11: TLabel; lbl12: TLabel; tmSystem: TTimer; procedure bmbScoresClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure BitBtnAddClick(Sender: TObject); procedure BitBtnAddMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure BitBtnMultiplyClick(Sender: TObject); procedure BitBtnMultiplyMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure BitBtnSubtractClick(Sender: TObject); procedure BitBtnSubtractMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure BitBtnDivideClick(Sender: TObject); procedure BitBtnDivideMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure bmbPlayer2Click(Sender: TObject); procedure bmbplayer3Click(Sender: TObject); procedure bmbplayer4Click(Sender: TObject); procedure bmbplayer5Click(Sender: TObject); procedure bmbplayer6Click(Sender: TObject); procedure BitBtnYesClick(Sender: TObject); procedure BitBtnNoClick(Sender: TObject); procedure btnAddClick(Sender: TObject); procedure btnMutiplyClick(Sender: TObject); procedure btnSubtractionClick(Sender: TObject); procedure btnDivideClick(Sender: TObject); procedure BitBtnCancelClick(Sender: TObject); procedure bmbplayer1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frmIntermediate: TfrmIntermediate; inputstr : string; iRight, iWrong, iRightAll, iWrongAll, iadd1, iadd2,iresult, iresult2: Integer; player : integer; implementation uses assignment2_MDJ_u, assignment9_MDJ_u, assignment3_MDJ_u, assignment7_MDJ_u, assignment10_MDJ_u; {$R *.dfm} procedure sub; begin repeat Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; until iadd1 > iadd2; if iadd1 > iadd2 then iResult := iAdd1 - iAdd2 else iAdd2 := Random(20) + 1; end; procedure TfrmIntermediate.bmbScoresClick(Sender: TObject); begin frmIntermediate.Visible := False; frmIntermediateScore.Visible := True; if strtoint(lbltotalcorr.Caption) > (strtoint(lbl1.Caption) and strtoint(lbl4.Caption) and strtoint(lbl7.Caption) and strtoint(lbl10.Caption) and strtoint(lbl13.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName1.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lblTotalCorr.Caption; end else begin if strtoint(lbl1.Caption) > (strtoint(lbltotalcorr.Caption) and strtoint(lbl4.Caption) and strtoint(lbl7.Caption) and strtoint(lbl10.Caption) and strtoint(lbl13.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName2.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lbl1.Caption; end else begin if strtoint(lbl4.Caption) > (strtoint(lbltotalcorr.Caption) and strtoint(lbl1.Caption) and strtoint(lbl7.Caption) and strtoint(lbl10.Caption) and strtoint(lbl13.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName3.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lbl4.Caption; end else begin if strtoint(lbl7.Caption) > (strtoint(lbltotalcorr.Caption) and strtoint(lbl1.Caption) and strtoint(lbl4.Caption) and strtoint(lbl10.Caption) and strtoint(lbl13.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName4.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lbl7.Caption; end else begin if strtoint(lbl10.Caption) > (strtoint(lbltotalcorr.Caption) and strtoint(lbl1.Caption) and strtoint(lbl4.Caption) and strtoint(lbl7.Caption) and strtoint(lbl13.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName5.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lbl10.Caption; end else begin if strtoint(lbl13.Caption) > (strtoint(lbltotalcorr.Caption) and strtoint(lbl1.Caption) and strtoint(lbl4.Caption) and strtoint(lbl7.Caption) and strtoint(lbl10.Caption)) then begin frmIntermediateScore.pnlHigh.Visible := True; frmIntermediateScore.lblName.Caption := frmName.EdtName6.Text; frmIntermediateScore.lblScore.Caption := frmIntermediate.lbl13.Caption; end else begin frmscoresenior.pnlHigh.Visible := False; end; end; end; end; end; end; end; procedure TfrmIntermediate.FormActivate(Sender: TObject); begin iRightAll := 0; iRightAll := 0; iRight := 0; iWrong := 0; frmPrimary.Brush.Color := clBtnFace; lbltotalcorr.Caption := '0'; lblTotalwrong.Caption := '0'; lblTotal.Caption := '0'; lbl1.Caption := '0'; lbl2.Caption := '0'; lbl3.Caption := '0'; lbl4.Caption := '0'; lbl5.Caption := '0'; lbl6.Caption := '0'; lbl7.Caption := '0'; lbl8.Caption := '0'; lbl9.Caption := '0'; lbl10.Caption := '0'; lbl11.Caption := '0'; lbl12.Caption := '0'; lbl13.Caption := '0'; lbl14.Caption := '0'; lbl15.Caption := '0'; end; procedure TfrmIntermediate.BitBtnAddClick(Sender: TObject); var A, icounter : integer; begin icounter := 0; if player = 1 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lblTotalCorr.Caption := IntToStr(iRightAll) else lblTotalwrong.Caption := IntToStr(iWrongAll); lblTotal.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 2 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl1.Caption := IntToStr(iRightAll) else lbl2.Caption := IntToStr(iWrongAll); lbl3.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 3 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl4.Caption := IntToStr(iRightAll) else lbl5.Caption := IntToStr(iWrongAll); lbl6.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 4 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl7.Caption := IntToStr(iRightAll) else lbl8.Caption := IntToStr(iWrongAll); lbl9.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 5 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl10.Caption := IntToStr(iRightAll) else lbl11.Caption := IntToStr(iWrongAll); lbl12.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 6 then for A := 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 + iAdd2; Inputstr := InputBox('Addition [ + ]', IntToStr(iAdd1) + '+' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl13.Caption := IntToStr(iRightAll) else lbl14.Caption := IntToStr(iWrongAll); lbl15.Caption := IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomp.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; end; procedure TfrmIntermediate.BitBtnAddMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin imgCorrect.Visible := False; imgWrong.Visible := False; end; procedure TfrmIntermediate.BitBtnMultiplyClick(Sender: TObject); var A, iCounter : integer; begin icounter := 0; if player = 1 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lblTotalCorr.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lblTotalwrong.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lblTotal.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 2 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl1.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl2.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl3.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 3 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl4.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl5.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl6.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 4 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl7.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl8.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl9.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 5 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl10.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl11.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl12.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 6 then For A:= 1 to 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult := iAdd1 * iAdd2; Inputstr := InputBox('Multiplication [ x ]', IntToStr(iAdd1) + 'x' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then iRight := (iRight + 1) else iRight := (iRight + 1); If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl13.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl14.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl15.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcomple.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; end; procedure TfrmIntermediate.BitBtnMultiplyMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin imgCorrect.Visible := False; imgWrong.Visible := False; end; procedure TfrmIntermediate.BitBtnSubtractClick(Sender: TObject); var icounter : integer; begin icounter := 0; if player = 1 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lblTotalCorr.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lblTotalwrong.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lblTotal.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 2 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl1.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl2.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl3.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 3 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl4.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl5.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl6.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 4 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl7.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl8.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl9.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 5 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl10.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl11.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl12.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; if player = 6 then while icounter < 10 do begin sub; Inputstr := InputBox('Subtraction [ - ]', IntToStr(iAdd1) + '-' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl13.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl14.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl15.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); iCounter := icounter + 1; lblTotalcompl.Caption := 'Number of sums complted: ' + inttostr(iCounter); end; end; procedure TfrmIntermediate.BitBtnSubtractMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin imgCorrect.Visible := False; imgWrong.Visible := False; end; procedure TfrmIntermediate.BitBtnDivideClick(Sender: TObject); var counter : integer; begin counter := 0; if player = 1 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl1.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl2.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl3.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; if player = 2 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl4.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl5.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl6.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; if player = 3 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl7.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl8.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl9.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; if player = 4 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl10.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl11.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl12.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; if player = 5 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lbl13.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lbl14.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lbl15.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; if player = 6 then while Counter < 10 do begin Randomize; iAdd1 := Random(20) + 1; iAdd2 := Random(20) + 1; iResult2 := iAdd1 * iAdd2; iResult := iResult2 div iadd2; Inputstr := InputBox('Addition [ / ]', IntToStr(iresult2) + '/' + IntToStr(iAdd2) + ' - Always put in a Answer','0'); If StrToInt(Inputstr) = iResult then inc(iRight,1) else inc(iWrong,1); If StrToInt(Inputstr) = iResult then begin imgCorrect.Visible := True; imgWrong.Visible := False; end; If StrToInt(Inputstr) <> iResult then begin imgCorrect.Visible := False; imgWrong.Visible := True; end; If StrToInt(Inputstr) = iResult then showmessage('Welldone!!! It is ' + IntToStr(iresult)) else showmessage('Better Luck Next time! The answer is: ' + IntToStr(iresult)); If StrToInt(Inputstr) = iResult then inc(iRightAll,1) else inc(iWrongAll,1); if StrToInt(Inputstr) = iResult then lblTotalCorr.Caption := 'Total number of Correct Answers: ' + IntToStr(iRightAll) else lblTotalwrong.Caption := 'Total number of Incorrect Answers: ' + IntToStr(iWrongAll); lblTotal.Caption := 'Total sums Completed: ' + IntToStr(iRight + iWrong); counter := counter + 1; lbltotalcomplet.Caption := 'Number of sums complted: ' + inttostr(counter); end; end; procedure TfrmIntermediate.BitBtnDivideMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin imgCorrect.Visible := False; imgWrong.Visible := False; end; procedure TfrmIntermediate.bmbPlayer2Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 2; end; procedure TfrmIntermediate.bmbplayer3Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 3; end; procedure TfrmIntermediate.bmbplayer4Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 4; end; procedure TfrmIntermediate.bmbplayer5Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 5; end; procedure TfrmIntermediate.bmbplayer6Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 6; end; procedure TfrmIntermediate.BitBtnYesClick(Sender: TObject); begin gbAdd.Visible := false; gbSubtract.Visible := False; gbMultiply.Visible := False; frmPhase.Show; pnlClosePage.Visible := False; frmPrimary.Visible := False; imgCorrect.Visible := False; imgWrong.Visible := True; end; procedure TfrmIntermediate.BitBtnNoClick(Sender: TObject); begin pnlClosePage.Visible := False; bitbtnBack.Visible := True; end; procedure TfrmIntermediate.btnAddClick(Sender: TObject); begin gbAdd.Visible := True; gbChoice2.Visible := False; bitbtnAdd.Visible := True; bitbtnback.Visible := True; imgWrong.Visible := False; imgCorrect.Visible := False; end; procedure TfrmIntermediate.btnMutiplyClick(Sender: TObject); begin gbMultiply.Visible := True; gbChoice2.Visible := False; bitBtnMultiply.Visible := True; bitbtnback.Visible := True; imgWrong.Visible := False; imgCorrect.Visible := False; end; procedure TfrmIntermediate.btnSubtractionClick(Sender: TObject); begin gbSubTract.Visible := True; gbChoice2.Visible := False; bitbtnSubtract.Visible := True; imgWrong.Visible := False; imgCorrect.Visible := False; end; procedure TfrmIntermediate.btnDivideClick(Sender: TObject); begin gbDivide.Visible := True; gbChoice2.Visible := False; bitbtnDivide.Visible := True; bitbtnback.Visible := True; imgWrong.Visible := False; imgCorrect.Visible := False; end; procedure TfrmIntermediate.BitBtnCancelClick(Sender: TObject); begin frmPhase.Visible := True; frmPrimary.Visible := False; end; procedure TfrmIntermediate.bmbplayer1Click(Sender: TObject); begin gbchoice2.Visible := True; gbPlayer.Visible := False; player := 1; end; end.//
Last edited by WingedPanther; 10-13-2008 at 10:59 AM. Reason: add code tags
That isn't the .dfm file that is throwing the errors.
Hi,
the file should be assignment4_MDJ_u.dfm. The one that you posted is assignment4_MDJ_u.pas.
Patrick Ooi, http://www.webhyper.com
Hi
Sorry That I was not on for a while but my Internet connection was down.
I solved the problem by replacing the files with older backup ones that do work, I had to only recode some things.
At the moment I'm having the same problem with another file, but it is not the only one, and when I restart it sometimes works other times gives the error, but when I modify it the time it works it causes windows to have a blue screen. IT may have something to do with the users(other forms launching from that form), but I doubt it. I open the .dfm, but Ive never modified the file's i don't know how to use it and prefer the GUI interface. The file has also worked fine until it as above suddenly restarts when Delphi stops responding and causes windows to have a memory read error. If I delete the users line, the program asks if i would like to add the unit to it again and then it displays the file path error instead. Then when I reopen the project, it complains that a curtain line is the problem. If I go into the .dfm and look for the line and then go back to the form and delete the object that is causing it(the object is 32bit and worked for a long time) it complains that the next line has a problem. It therefore has a 16bit error with the next object. Which in one case was Delphi's image component.
If you need the .dfm ask, but it is long or tell me which part you need. This problem occurs on every computer. I also wonder if windows is missing a file as when I try run a backup - backup copy on another computer it works, but is till does not work on mine, must I re-install delphi, replace a windows file (tell me if this is the case) or it may be the program at fault.
I hope this is in enough detail
Last edited by Sparky; 10-16-2008 at 07:53 AM. Reason: Missing Information
There are several things you have to look at: version of Delphi, .DFM, and .pas files. They're all inter-related and pretty necessary to help with debugging.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks