Board index » delphi » Incompatible types 'string' and 'Tdbedit'

Incompatible types 'string' and 'Tdbedit'

Hello,
I'm trying to use a dbedit box to insert records into a paradox table
It must also update a label on the form.
When I run the program I get
'Incompatible types  'string' and 'Tdbedit''
When the label's caption is being changed...
Heres the line of code.

Label1.caption:=vininsert;

This is when I get the error

What am I doing wrong?
Thanks
Phil

 

Re:Incompatible types 'string' and 'Tdbedit'


Hi Phillip

Quote
> Label1.caption:=vininsert;

if vininsert is the name of your TDBEdit, this will cause the error you
mentioned.

Try Label1.caption := vininsert.Text;

Quote
> Thanks
> Phil

Hope it helps...

Simon Brotherton

Re:Incompatible types 'string' and 'Tdbedit'


How is vininsert declared?  What is it?

Bill

(Sorry but TeamB cannot answer support questions received via email.)
(To send me email for any other reason remove .nospam from my address.)

Re:Incompatible types 'string' and 'Tdbedit'


VinInsert is the name of the table component
On Thu, 29 Jan 1998 00:40:12 GMT, Bill_T...@compuserve.com.nospam

Quote
(Bill Todd (TeamB)) wrote:
>How is vininsert declared?  What is it?

>Bill

>(Sorry but TeamB cannot answer support questions received via email.)
>(To send me email for any other reason remove .nospam from my address.)

Re:Incompatible types 'string' and 'Tdbedit'


Ah.  In that case try:

Label1.Caption := VinInsert.FieldByName('SomeFieldName').AsString;

VinInsert is the instance variable for the TTable object so it is a
pointer to an object of type TTable.  That is why you are getting the
type mismatch error.  You must assign the value property of the field
object that contains the data for the field in the table to your
label's caption property.

Bill

(Sorry but TeamB cannot answer support questions received via email.)
(To send me email for any other reason remove .nospam from my address.)

Other Threads