Solved

Data-Aware Checkbox: ValueUnchecked problem

Posted on 1998-03-03
6
605 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 118
Correct Component for Shopping Cart. 2 95
delphi parse string to params 3 97
Convert a string into a TDateTime 5 50
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now