Solved

Data-Aware Checkbox: ValueUnchecked problem

Posted on 1998-03-03
6
610 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
  • 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
Industry Leaders: 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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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