Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

GET text from TDBEdit

Posted on 2006-04-02
15
Medium Priority
?
403 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:rafaelrgl
  • 4
  • 4
  • 2
  • +4
15 Comments
 
LVL 8

Expert Comment

by:RickJ
ID: 16357069
Try checking the value of DBedit.Text in the keyup event of the DBEdit.
0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 16357887
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
 
LVL 11

Assisted Solution

by:calinutz
calinutz earned 150 total points
ID: 16357889
var
 s:string;
begin
...
s:=DBEdit1.Text;
...


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:calinutz
ID: 16357894
Also you could do the check in the onExit event of the DBEdit.

Regards
0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 16357912
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 16357915
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
 
LVL 20

Assisted Solution

by:Mark Brady
Mark Brady earned 150 total points
ID: 16357965
Exactly my point Kretzschmar :)
0
 
LVL 14

Assisted Solution

by:Pierre Cornelius
Pierre Cornelius earned 150 total points
ID: 16358377
If you are using cached updates, you could use the field's OldValue and CurValue properties to get info about the field values.
0
 
LVL 9

Assisted Solution

by:sun4sunday
sun4sunday earned 150 total points
ID: 16358931
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
 
LVL 1

Author Comment

by:rafaelrgl
ID: 16359906
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
 
LVL 1

Author Comment

by:rafaelrgl
ID: 16359928
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
 
LVL 27

Accepted Solution

by:
kretzschmar earned 150 total points
ID: 16360029
>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
 
LVL 1

Author Comment

by:rafaelrgl
ID: 16360074
>DBETELE.Text
>DBETIPO.Text

This Fields Above.
0
 
LVL 1

Author Comment

by:rafaelrgl
ID: 16365621
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
 
LVL 20

Expert Comment

by:Mark Brady
ID: 16368031
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question