Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Value empty in With block
Tue, Aug 11 2015 1:45 PMPermanent Link

Trinione

The 'edtPhone.text' value appears in the ShowMessage command, however, it is empty in the With block.

Is this a bug?

-------------------------------------------------------------
ShowMessage(edtPhone.text);
     With MyDataset do
     begin                   
       Database.StartTransaction;
       Open;
       MyDataset.Insert(true);
       Columns['phone'].AsString := edtPhone.text;
       Save;                     
       Database.Commit;
     end;
-------------------------------------------------------------
Tue, Aug 11 2015 2:01 PMPermanent Link

Trinione

The issues is nothing to do with the 'With block. It has to do with the edtPhone.text not being accessible after the MyDataset.Open command is called.

Creating a variable and saving to it and then using that variable works though.

Should this occur, or is it a bug?

-------------------------------------
var
 phoneNumber: string;
.....

     phoneNumber := edtPhone.text;
     dsMgrDebtorPhone.Open;       
ShowMessage(phoneNumber);  // this shows the phone number, whereas ShowMessage(edtPhone.text) does not

--------------------------------------------
Tue, Aug 11 2015 5:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< The issues is nothing to do with the 'With block. It has to do with the edtPhone.text not being accessible after the MyDataset.Open command is called. >>

Is the edtPhone edit control bound to that dataset ?  If so, then it will be blank if there aren't any rows in the dataset or the current row doesn't have a value in the column that the edit control is bound to.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Aug 12 2015 4:11 PMPermanent Link

Trinione

<< Is the edtPhone edit control bound to that dataset ?  If so, then it will be blank if there aren't any rows in the dataset or the current row doesn't have a value in the column that the edit control is bound to. >>

Ah yes. That's it.

Thanks you.
Image