Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Clearing edit boxes

delphi form box edit databae dbedit

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 delphiuser

delphiuser

    CC Newcomer

  • Member
  • PipPip
  • 23 posts

Posted 24 December 2012 - 06:27 AM

i am having problems clearing labeledit boxes. i recieve this error when i try to clear . " Exception class EConvertError with message ''''' is not a valid integer value'". (edit) How do i clear a DBGRID at a click of a button .

this is my code to clear edit box .
begin
lbledtquantity.Clear;
lbledtcost.Clear;
dbedit1.Clear;
dbedit2.Clear;
dbedit3.Clear;
dbedit4.Clear;
end;

Edited by delphiuser, 24 December 2012 - 07:44 AM.


#2 Luthfi

Luthfi

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts

Posted 24 December 2012 - 08:41 AM

When working with DB-aware controls, mostly you code the underlying field(s) or datasets. Never directly manipulate data from the DB-aware controls. In your case, you should not clear the TDBEdit-s. Clear the underlying fields, instead.

For example, if dbEdit1 is connected to a field named "CustomerName" of TblOrders dataset, then to clear it you do:

  ..
  tblOrders.FieldByName('CustomerName').Clear;
  ..

The same goes with TDbGrid. Because it's also DB-Aware controls. You clear the underlying fields.




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download