DBEdit1 and DatetoStr!!! Date disappear! lazarus / 16-Databases ---------------------------------------------------------------------- Robert W.B. · 2013-10-12 03:20 I have some datacontrols on a form and it work fine  but, I have a DBEdit.text and a onClick event on it.   DBEdit1.text:=DateToStr(Date); When I click the DBEdit field The onClick event shall show me a date and the date appear in the DBEdit box as it should but, if I click an other datacontrol in the form the Date disappear in DBEdit1.text!! leaving it empty! Anyone understand what's going on? Best regards ---------------------------------------------------------------------- LacaK · 2013-10-17 05:35 Use:   DBEdit1.Field.AsDateTime:=Date; ---------------------------------------------------------------------- Robert W.B. · 2013-11-05 23:18 Thanks but,it don't work! I've got error messgae External sigsev when I click the onclick event for the code! ---------------------------------------------------------------------- Zoran · 2013-11-06 07:17 Please create and upload a simple application which shows the problem, with the database DDL, the simplest possible (probably you only need there one table with one field). Also tell which DBMS you use, which Lazarus and FPC version, which OS, which widgetset? ---------------------------------------------------------------------- Robert W.B. · 2013-11-06 21:39 I have a DBCalendar1 on form2 and a DBEdit1 on form 1. I want when a user click in the dbcalendar on a date that it will appear on the DBedit1 datafield but I can't understand how to do it! Here is the code that don't work. form1.DBEdit1.Field.AsDateTime:=form2.DBCalendar1Click(DBcalendar1.Dat e);  form2.Close; ---------------------------------------------------------------------- LacaK · 2013-11-07 05:30 How is defined "DBCalendar1Click" ? it seems to me like event procedure ? But then you can not assign result to DBEdit1 ? DBCalendar1 and DBEdit1 are linked to same DataSource ? Can you post full project ? ---------------------------------------------------------------------- exdatis · 2013-11-07 07:28 I suppose that it is necessary to first determine the state of the DataSet, and then apply the values. eg   if (your_ds.State in [dsEdit, dsInsert]) then     ---apply ---------------------------------------------------------------------- exdatis · 2013-11-07 07:32 Also, I suggest to create dialog. Then if(your_dlg.ShowModal = mrOk) then   your_date_field.AsDate:= your_dlg.Calendar.Date //if state [dsEdit, dsInsert] Regards ---------------------------------------------------------------------- Zath · 2013-11-07 10:36 You say you're clicking on another datacontrol. Are you clicking on a control that's moving to the next record ? If you're moving to another record, your previous entry will be cleared from view of a DBEdit. ---------------------------------------------------------------------- exdatis · 2013-11-08 06:17 Not so, I suggest to use the date selection dialog. After that, you can save the record(post) and go to a new record(dataSet.Next). ---------------------------------------------------------------------- exdatis · 2013-11-08 06:21 You use data control(db edit) to show value of data set(current record-field).