Testing to see if there is nothing in String?

I'm trying to copy a string out of a string field and into a TMemo This is what i'm using:

  Memo1.Text := F_MainMenu.TB_Output['Comment']

but if the Comment field does not have a string in it then the system gives me a EVariant Error 'Invalid Variant Conversion' I tried testing like this:

if not (F_MainMenu.TB_Output['Comment'] = '') then
      Memo1.Text := F_MainMenu.TB_Output['Comment'];

but it does not help. Thanks for your time....

Rick S.
Rick_SAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ygolanConnect With a Mentor Commented:
Try comparing F_MainMenu.TB_Output['Comment'] to null instead of ''.
0
 
Rick_SAuthor Commented:
is null #0 if it is then that does not work...
0
 
ygolanCommented:
No, null is a special constant, of type variant. Here is the complete code :



if not (F_MainMenu.TB_Output['Comment'] = null) then
 Memo1.Text :=  F_MainMenu.TB_Output['Comment'];
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Rick_SAuthor Commented:
Thanks for your time and quick response. That Worked great I gave you an extra 10 points for the example... also, did you see my other question it's worth 350 and nobody has touched it. Thanks again...

Rick S.
0
 
Rick_SAuthor Commented:
Sorry ygolan I tried to up the point value and it does not look like it worked if you would like I'll post a 10 point question and let you answer it and give you the points let me know thanks...

Rick S.
0
 
ygolanCommented:
Rick,

That's ok, don't worry about it.

Let me know what is the title of your other question, and I'll take a look at it.
0
 
Rick_SAuthor Commented:
Thanks again.....

The title of the other question is:

    "SetScrollInfo and ScrollInfo"

The date was 7/31

Part of the second part of my question is also asked by PhiNet on 7/25 in the question 'Scrollbar In DBGrid ( Delphi 3 )' that has not yet been answered. If you can answer my question then you'll also be able to pick up the credit for the 100 point question of his.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.