(HOW?) Assigning value of TDBEdit to a TLabel 
Author Message
 (HOW?) Assigning value of TDBEdit to a TLabel

Quote:

>Newsgroups: comp.lang.Pascal.delphi.components
>Subject: assigning value of a TDBEdit to a TLabel (HOW?)
>Summary:
>Expires:
>Sender:
>Followup-To:
>Distribution:
>Organization: Dept. of Computer Science, University of Ottawa
>Keywords:
>Cc:

>Here's my problem,

>I want to assign the value contained in one of my TDBEdit's in a TLabel on
>another form (I have no problem assigning a TLabel on one form to another
>TLabel on another form).  The problem is that it doesn't look like there
>is a text or value property in TDBEdit.  How would I go about doing what I
>want without changing my TDBEdit object.

>Daniel Lortie


>Any help will be greatly appreciated!!!

Don't think of the data as stored in the TDBEdit, but the datasource
connected to the TDBEdit (TQuery or TTable).  An answer, I believe, is to
take the datafield that the DBEdit is looking at (say, EditField) from
the datasource (say, MyTable) and get the info there:

  MyLabel.Caption := MyForm.MyTable.FieldByName('EditField').AsString;

This should work.

Marcus Chapman
------------------------------------------------
The information I post is wholly my own, and not
necessarily the view of my employer.  It is
always intended to help, although that is not
always the case. -mjc
------------------------------------------------



Fri, 08 May 1998 03:00:00 GMT  
 (HOW?) Assigning value of TDBEdit to a TLabel

writes:

Quote:
>Here's my problem,

>I want to assign the value contained in one of my TDBEdit's in a
TLabel on
>another form (I have no problem assigning a TLabel on one form to
another
>TLabel on another form).  The problem is that it doesn't look like
there
>is a text or value property in TDBEdit.  How would I go about doing
what I
>want without changing my TDBEdit object.

>Daniel Lortie


>Any help will be greatly appreciated!!!

There is a Text property for the TDBEdit component.  It is a Run-Time
only property though so you wont see it in the Object Inspector.  

A better way to get or use that value is to get the Value of the field
that is linked to the DBGrid.  Use the fields editor of the table to
define the field as an object.

Hope that helps...

Marc



Sat, 09 May 1998 03:00:00 GMT  
 (HOW?) Assigning value of TDBEdit to a TLabel

Quote:
>Daniel Lortie


>Any help will be greatly appreciated!!!

Try to make a refresh of the object


Fri, 15 May 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. (HOW?) Assigning value of TDBEdit to a TLabel

2. DBLookupComboBox - how to assign a value?

3. assigning sql values to variables

4. How to assign this values in pascal ?

5. TBatchMove component allow assigning value during execute?

6. Beginner: Delphi 1, Assigning Values to dialog objects

7. Assigning value to a DBComboLookUp Box

8. Limiting the number of values that can be assigned to a field

9. Help - Table fields with no values assigned to them

10. How to I assign a value to DBEdit1 ?

11. Assigning value to binary field. PLEASE HELP

12. Using the Date value for assigning Today's date to a field

 

 
Powered by phpBB® Forum Software