GET text from TDBEdit

I would like to get what the user digit on TDBEdit when he´s inserting some field.

Example.

I have some TDBEdit on my form.
The User insert some text on TDBEdit like "RAFAELRGL" when he was inserting.
HOW CAN I GET THAT TEXT.
LVL 1
rafaelrglAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RickJCommented:
Try checking the value of DBedit.Text in the keyup event of the DBEdit.
0
Mark BradyPrincipal Data EngineerCommented:
also you could do it 2 ways.  As stated above and also just in case the user presses the ENTER key to enter the info go to the onkeypress event for that control and use add something like....

var
s: string;

begin
if key=#13 then
s:= dbedit1.text; // Now you can do something with the 's' string.  Save it to a file or something.

regards
Elvin
0
calinutzCommented:
var
 s:string;
begin
...
s:=DBEdit1.Text;
...


0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

calinutzCommented:
Also you could do the check in the onExit event of the DBEdit.

Regards
0
Mark BradyPrincipal Data EngineerCommented:
Haha it seems we are all on the same wave length here !

I suppose if Rafaelrg can give us a more detailed description of exactly what he wants and what sort of application this is then we can give a more detailed response.  However, what we have supplied might be ok for his use.

elvin
0
kretzschmarCommented:
or in the beforepost event of the dataset directly from the associated tfield . . .
or in the onValidate event of the tfield . . .
or in the inSetText event of the tfield . . .
or . . .
0
Mark BradyPrincipal Data EngineerCommented:
Exactly my point Kretzschmar :)
0
Pierre CorneliusCommented:
If you are using cached updates, you could use the field's OldValue and CurValue properties to get info about the field values.
0
sun4sundayCommented:
Don't use
TabelNameDataField.Value
It will give the available data in the datafield until you post the new vaule. Even if you make changes on the dbText it will reflect only on dbText not on datafield until you post it.

sun4sunday

0
rafaelrglAuthor Commented:
I WAS CHECKING MY CODE AND THE PROBLEM IS NOT TBEDIT. TBEDIT.TEXT WORKS GOOD. BUT WHEN I TRY TO DO THIS SENTENCE SQL, DOES NOT WORK. THE FIELD IS EMPTY.

   If DBTELE.DataSource.DataSet.State = dsInsert then
   begin
     try
        Bd.Query_Clientes_Fone.SQL.Clear;
        BD.Query_Clientes_Fone.SQL.Add('insert into TB_USER_FONE');
        BD.Query_Clientes_Fone.SQL.Add('(IDUSUARIO, TELEFONE, TIPO)');
        BD.Query_Clientes_Fone.SQL.Add(' values');
        BD.Query_Clientes_Fone.SQL.Add('(' + DBClientes.Fields[0].Text + ',''' + DBETELE.Text + ''',''' + DBETIPO.Text + ''')');
        Bd.Query_Clientes_Fone.ExecSQL;
     except
     end;
     Bd.Query_Clientes_Fone.SQL.Clear;
     Bd.Query_Clientes_Fone.SQL.Add('select * from TB_USER_FONE WHERE IDUSUARIO = :ID');
     Bd.Query_Clientes_Fone.ExecSQL;
     If not BD.Query_Clientes_Fone.Active Then
     begin
       BD.Query_Clientes_Fone.Open;
     end;
   end else begin
     BD.Query_Clientes_Fone.ApplyUpdates;
   end;
0
rafaelrglAuthor Commented:
wave length.

DON´T SAY THAT TO OTHER USER ELVIN. I GOT A PROBLEM AND I TRY SO HARD TO MAKE MY CODE WORKS GOOD.
0
kretzschmarCommented:
>THE FIELD IS EMPTY.

which field?
>DBClientes.Fields[0].Text
>DBETELE.Text
>DBETIPO.Text

meikl ;-)

p.s.: there is no need to write all in capital letters (is harder to read)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rafaelrglAuthor Commented:
>DBETELE.Text
>DBETIPO.Text

This Fields Above.
0
rafaelrglAuthor Commented:
Thanks, I DID, it is working now. Here is the code:

   If DBTELE.DataSource.DataSet.State = dsInsert then
   begin
      Bd.SQLClientes_Fone.InsertSQL.Clear;
      BD.SQLClientes_Fone.InsertSQL.Add('insert into TB_USER_FONE');
      BD.SQLClientes_Fone.InsertSQL.Add('(IDUSUARIO, TELEFONE, TIPO, PADRAO)');
      BD.SQLClientes_Fone.InsertSQL.Add(' values');
      BD.SQLClientes_Fone.InsertSQL.Add('(' + DBClientes.Fields[0].Text + ', :TELEFONE, :TIPO, :PADRAO)');
      BD.Query_Clientes_Fone.ApplyUpdates;
   end;
   BD.Query_Clientes_Fone.ApplyUpdates;
0
Mark BradyPrincipal Data EngineerCommented:
what ?  I think you missunderstand my comment but it's probably you poor english so don't worry about it.  I'm glad you got it worked out.
Elvin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.