Solved

Data-Aware Checkbox: ValueUnchecked problem

Posted on 1998-03-03
6
611 Views
Last Modified: 2010-04-04
I am using data-aware check boxes, and I want the boxes to be unchecked if the value in the respective field is NULL, ie nothing there, a blank field, no data. As if no data had been entered yet.

I've tried the following and they don't work:

1. DBCheckBox.ValueUnchecked := ''; (no spaces)

2. DBCheckBox.ValueUnchecked := NULL;

3. DBCheckBox.ValueUnchecked := ' '; (1 space)

Can you help me here?
0
Comment
Question by:jsweby
[X]
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
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360039
Hi jsweby,

You have to use IsNull

eg. Table1.FieldByName('CheckThis').IsNull

Returns true if field content is empty, otherwise false.
0
 
LVL 4

Author Comment

by:jsweby
ID: 1360040
The ValueChecked and ValueUnchecked properties of DBCheckBox cannot take Boolean values, so how do you suggest I implement your answer? The value on the right-hand side of the property ValueUnchecked has to be of type String, as in my original question above.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1360041
Wow, don't eat my heart out!

What about ....ValueUnchecked := #0

Besides my first answer can be used if nothing else helps or nothing else is possible :

e.g. DBCheckBox.Checked := (Table1.FieldByName('CheckThis').IsNull = False);


Q : What type is the underlying data?

I just want to help, you know.

Regards, Zif.
0
Independent Software Vendors: 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!

 
LVL 4

Author Comment

by:jsweby
ID: 1360042
Hi ZifNab,

Sorry if you got the impression I was having a go at you, I wasn't!

I've just realised that this component DOES have a Checked value which can be set to True or False. I thought it didn't, which I thought was strange seeing as the standard CheckBox component does. That's why I've been trying to get this ValueUnchecked to work, which only takes a String and not a Boolean value.

Thanks for trying to help, sorry you took my comments the wrong way!
0
 
LVL 4

Author Comment

by:jsweby
ID: 1360043
Zif,

If you submit your answer again, I'll give you the points. I can't see how to do it from a comment
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1360044
Hi jsweby,

Sorry about my last comment, had a bad day and couldn't take much at that time ...

What about ....ValueUnchecked := #0

or DBCheckBox.Checked := (Table1.FieldByName('CheckThis').IsNull = False);

Regards, Zif.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…

732 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