Jump to content

Henry Olive

Members
  • Content Count

    284
  • Joined

  • Last visited

Everything posted by Henry Olive

  1. Henry Olive

    Pos

    Thank You so much Stano I just found out Contains (StrUtils) I solved my problem with Contains instead of Pos
  2. Henry Olive

    Pos

    Thank You Stano No it is not a DBTable, CDS1 table is a Query Result
  3. Henry Olive

    Split String

    Good Day, Delphi 10.3 Below codes works w/o any problem Edit1.Text := '22-1568'; Edit2.Text := SplitString(Edit1.Text,'-')[0]; // result= 22 Edit3.Text := SplitString(Edit1.Text,'-')[1] // result:= 1568 When i try the same code like below ( *There is StrUtils in Uses* ) I'm getting Not enough actual parameters error msg. Str := CDS1.FieldByName('DOCNO').asString; // which is '22-1568' LeftStr := SplitString(Str,'-') [0]; RightStr := SplitString(Str,'-') [1]; What am i doing wrong ? Thank You
  4. Henry Olive

    Split String

    Thank You SO SO SO MUCH Uwe, Lars, Programmer I solved the problem as below 1- In Uses, I changed StrUtils to System.StrUtils in USES 2- In Uses, I moved QRCtrls, QuickRpt units BEFORE System.StrUtils (as Uwe said.) 3- In codes, I used System.StrUtils.SplitString( ... , ... ) (as Lars said.)
  5. Henry Olive

    Split String

    Thank you so much Lars I tried System.StrUtils.SplitString('-', MyStr) [0]; but still get the same error If i remove QRCtrls, QuickRpt from Uses, below codes work fine w/o any error MyStr := CDS1.DataSet.FieldByName('DOCNO').AsString; MyLeftStr := SplitString('-',MyStr) [0]; MyRightStr := SplitString('-',MyStr) [1];
  6. Henry Olive

    Split String

    Thank you so much Uwe interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, DBCtrls, ToolWin, StdCtrls, ExtCtrls, Mask, Buttons, Grids, DBGrids, Menus, DB, DBClient,TypInfo, QRCtrls, QuickRpt, Math, FMTBcd, SqlExpr, Provider, System.Actions, Vcl.ActnList; type ..... implementation {$R *.dfm} Uses System.StrUtils, Udm, UItemCard, ULookUp;
  7. Henry Olive

    Split String

    Thank you SO MUCH Uwe, i'm really very very sorry for taking your time I added StrUtils at the end of the main Uses Clause but i get the same error I deleted StrUtils in the main Uses Clause and added uses of the implementation section but i get the same error
  8. Henry Olive

    Split String

    Thank you SO MUCH Lars, Uwe After i get the same error with Lars's suggestion i noticed below situation When i move my mouse cursor on SplitString in Delphi Editor, i saw Delphi shows Quick Report's SplitString In my uses there are QRCtrls, QuickRpt, StrUtils and i need to use a quickreport in that Unit. I also tried to change StrUtils in Uses to System.StrUtils but still get the same error What should i do now ?
  9. Henry Olive

    Split String

    Thank you so much Uwe I changed the var names to var MyStr, LeftMyStr, RightMyStr but i still get the same error msg. Thank You
  10. Good Day, My table looks like below (In a DBGrid) CODE ------- AAA AAA-AA AAA-AA-BB BBB BBB-BB BBB-BB-CC I want to make font color ClRed if the Value.Length <= 3 That is just AAA and BBB value's font.color should be red procedure TAccAccounts.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var Str : String; begin Str := DBGrid1.Columns[0].Field.Value; if Length(Str) <= 3 then DBGrid1.Columns[0].Font.Color := ClRed else DBGrid1.Columns[0].Font.Color := ClWindowText; Self.Canvas.FillRect(Rect); end; Eventhough Delphi makes AAA clRed but doesnt make BBB clRed it is still clBlack Thank You
  11. Henry Olive

    DBGrid1.Columns[1].Font.Color

    Sorry for late respond i was sick for couple of days Thank You so much Uwe, Lajos, Programmer
  12. I moved this topic from Object Pascal to here which is correct forum Good Day, Delphi 10.3 I have problem when filtering a table with non english character Button1.Click Event var SearchText :=String; begin SearchText :=Edit1.Text (Which is 'MİSA' ) CDS1.FilterOptions := [foCaseInsensitive]; CDS1.Filtered := False; CDS1.Filter := UPPER ( CATEGORY ) LIKE ' + QuotedStr (SearchText + '%'); CDS1.Filtered := True; end; Eventhough i have MİSA in the table's Category field, I get an empty result What am i doing wrong ? P.s : When i use ( In FB 3 Sql ) SELECT FROM MYTABLE WHERE UPPER(CATEGORY) LIKE 'MİSA%' I get expected results w/o any problem Thank You
  13. Henry Olive

    ClientDataset.Filter ( Non English Character )

    Thank You Dmitry
  14. Good Day, Delphi 10.3 I have problem when filtering a table with non english words Button1.Click Event var SearchText :=String; begin SearchText :=Edit1.Text (Which is 'MİSA' ) CDS1.FilterOptions := [foCaseInsensitive]; CDS1.Filtered := False; CDS1.Filter := UPPER ( CATEGORY ) LIKE ' + QuotedStr (SearchText + '%'); CDS1.Filtered := True; end; Eventhough i have MİSA in the table's Category field, I get an empty result What am i doing wrong ? P.s : When i use ( In FB 3 Sql ) SELECT FROM MYTABLE WHERE UPPER(CATEGORY) LIKE 'MİSA%' I get expected results w/o any problem Thank You
  15. Henry Olive

    Create Form

    Good Day, var CardForm:TForm; begin if Dataset = dm.Customer then CardForm := fCustomer else if Dataset = dm.Items then CardForm := fItems; ..... ..... if CardForm = Nil then CardForm := TForm(CardForm).Create(Self); end; I'm getting Access Violation err.msg What am i doing wrong ? Thank You
  16. Henry Olive

    Create Form

    Thank you SO much Peter, Programmer, Pat
  17. Henry Olive

    Create Form

    Thank you so much Programmer, Pat, David I'm really so sorry, i think i couldnt express my problem well cause of my unsuffient english. Suppose you have Form1 (Auto Create), Form2 (NOT Auto Create) , Form3 (NOT Auto Create) Lets say there is a Combobox1 in Form1 and ComboBox1.Items are 'A', 'B' Also there is a Button1 on Form1 According to above explanations here below my codes procedure TForm1.ShowForm (MyText : String); var MyForm : TForm; begin if MyText ='A' then MyForm := Form2 else if MyText ='B' then MyForm := Form3; if MyForm = Nil then MyForm := MyForm.Create(Self); // Problem is here, even if i use MyForm := TMyForm.Create(Self) MyForm.Show; end; procedure TForm1.Button1Click(Sender: TObject); begin ShowForm (ComboBox1.Text); end; Again i'm so sorry for not explaining the problem well.
  18. Henry Olive

    Create Form

    Thank You Stano, Attila Attila, CardForm := TCardForm.Create(Self) with above code i get below err. and cant compile i get [DCC Error] Unit2.pas(34): E2003 Undeclared identifier: 'TCardForm'
  19. Good Day, MyQuery Result is like below TotalCost...TotalCostWıthExp 100 110 Is it possible something like below function function.GetBomCosts (ItemCode:String): Value1,Value2 : Double Thank You
  20. Henry Olive

    Split String

    Good Day, MyVar could be just '22-1' or could be '22-1, 22-2' or could be '22-1, 22-2, 22-3' or more i dont know but always there is a comma ( , ) between the str numbers I'll use these str numbers in a Sql like .... WHERE DOCNOS IN ('22-1', '22-2', ....) My Problem is 1= I don't know how many str numbers there are in MyVar 2= How to add QuotedStr into each document str number for sql where in Thank You
  21. Henry Olive

    Split String

    Thank you so much Rollo62, Skyzoframe
  22. Henry Olive

    Page Control

    Good Day, I have a PageControl with 4 tabsheets When i move from a tabsheet (for examp. Tabsheet2) to another tabsheet ( for examp. Tabsheet3) I want to find out **from which TabSheet** i came to new TabSheet According to above example tabsheet names i want to find out TabSheet2 Thank You
  23. Henry Olive

    Page Control

    Thank you so much dummzeuch
  24. Henry Olive

    Server Data Path

    Good Day, Delphi 10.3 To Connect my Database (FB3) i use an INI file (it is in my EXE Path) which is like below [DataPath] Dir=MySrv:c:\MyApp\Data\ ( I fill the database name in Delphi ) In my program there is a Menu which shows (open) the BackUp Folder to the user, with below code BackUpPath := MyIniFile.ReadString('DataPath', 'Dir', '') + 'BackUp'; // MySrv:c:\MyApp\Data\BackUp ShellExecute(Handle, 'Open', PChar(BackUpPath), Nil, Nil, SW_SHOWNORMAL); Since BackUpPath = MySrv:c:\MyApp\Data\BackUp , above ShellExecute command doesnt work ShellExecute requires just c:\MyApp\Data\BackUp portion of the BackUpPath (Server's Local Path) I can do it with below codes , and i get correct result with below RightWord variable and ShellExecute works correctly but I think there should be a better way S:= MySrv:c:\MyApp\Data\BackUp if Pos('c:\',S) > 0 then X:=Pos('c:\',S) else X:=Pos('C:\',S); LeftWord:=Copy(S,1,X-1); RightWord:=Copy(S,X,Length(S)); which is c:\MyApp\Data\BackUp Thank You
  25. Henry Olive

    Server Data Path

    Thank you so much Vandrovnik
×