Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Testing to see if there is nothing in String?

Posted on 1997-08-07
Medium Priority
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 80 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'];
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

721 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