PDA

View Full Version : How can I input a data in DBEdit currency style


Mucan
06-11-2001, 10:25 AM
I want input data in DBEdit like 1.000.000. But it is must post in database like 1000000.

That is to say, I input format style but it is post integer value.

How can I do?

(I can use DBase for windows)

Tavares
06-11-2001, 07:29 PM
Try double click on table and right click on the editor.Then you add all fields and set the mask for the field you want by setting editmask(or something like this).
Set your field type to other than integer.

Hope it helps you!

Regards,
Eduardo Tavares
www.tavareswebsite.cjb.net

douglas
06-11-2001, 07:37 PM
here is a trick you can play around: use a TMaskEdit instead,let TDBEdit work "silently".

suppose you have DBEdit1 linked to Datasource1.

first add a TMaskEdit MaskEdit1 on your form, then add the following code in it's OnChange event:

procedure TForm1.MaskEdit1Change(Sender: TObject);
begin
if maskedit1.Modified then
begin
datasource1.Edit;
dbedit1.Field.AsInteger := StrToInt(MaskEdit1.Text);
end;

put the following code in DBEdit1's OnChange Event:

procedure TForm1.DBEdit1Change(Sender: TObject);
begin
maskedit1.Text := DBEDIT1.Text;
end;

set your DBEdit1.visible := False, run your application then!

douglas
06-11-2001, 07:42 PM
hi Mucan follow Tavares's suggestin unless you like complicated solution.

Mucan
06-12-2001, 02:24 AM
Ok. But I can make not formatted field in post field.(in data input DBedit show data like 9.000.000 , after post data like 9000000 in database.)

msalinas
06-12-2001, 09:33 AM
They are free at: http://www.rxlib.com/

Regards.


From Clipper to Delphi.... and happy with the change!