Testing to see if there is nothing in String?

Posted on 1997-08-07
Last Modified: 2010-04-04
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.
Question by:Rick_S
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
  • 4
  • 3

Accepted Solution

ygolan earned 20 total points
ID: 1340835
Try comparing F_MainMenu.TB_Output['Comment'] to null instead of ''.

Author Comment

ID: 1340836
is null #0 if it is then that does not work...

Expert Comment

ID: 1340837
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'];
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1340838
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.

Author Comment

ID: 1340839
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.

Expert Comment

ID: 1340840

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.

Author Comment

ID: 1340841
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.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

617 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