Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieve text in dbgrid cell

Posted on 1999-06-28
5
Medium Priority
?
145 Views
Last Modified: 2010-04-06
I am using a Tdbgrid linked to a paradox table in Delphi3. How can I retrieve the new text that a user has typed in without leaving the control or posting to database.  I have tried dbGrid1.SelectedField.AsString and dbGrid1.SelectedField.Test but both do not give me the new text.  I have a function key setup to do a search after they  type in a few characters.
0
Comment
Question by:jfreisen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1384930
Hi jfreisen,

If you only want to recieve the entered text, try this :

procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 pressedkey := pressedkey + char(key);
 showmessage(pressedkey);
end;

0
 
LVL 8

Accepted Solution

by:
ZifNab earned 150 total points
ID: 1384931
Hi jfreisen,

If you only want to recieve the entered text, try this :

procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 pressedkey := pressedkey + char(key);
 showmessage(pressedkey);
end;

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1384932
OnKeyPress maybe better event to handle this.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1384933
hi jfreisen,

another method

//DBGrid Upkey-Event, can also be another event
procedure TForm1.DBGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var i : Integer;
begin
  for i := 0 to DBGrid1.ControlCount - 1 do
    if DBGrid1.Controls[i] is TInplaceEdit then
      edit1.text := TInplaceEdit(DBGrid1.Controls[i]).EditText;
end;

meikl
0
 
LVL 2

Expert Comment

by:classmate
ID: 1384934
As far as i can remember from having the same problem one year ago, i tried to set the selected cell to the same one as the one already selected. Then the grid writes to the dataset, and the text can be read from the appropriate field (or at least i think so). The dataset can be canceled anyway.

I considered writing a inherited control from TDBGrid that solved the problem forever, but I've never been using DBGrids since :)

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 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