"BobAchgill" <(E-Mail Removed)> wrote in message
news:11f901c52ab7$14b16900$(E-Mail Removed)...
> I tried to use either a CheckBox or Radio Button to set a
> Boolean variable but I get Cast error message with either
> when I try to use the Boolean in an IF statement.
A Boolean variable can only hold True or False, which can /always/
be used in an IF.
> blnGetAllFolders = RadioButton1
RadioButton1 is a variable containing an object reference (to the
RadioButton control). You are assigning this object reference
into the variable blnGetAllFolders.
1) Turn on Option Strict. It really, /really/, *really* is worth it.
(If you're not running with Option Explicit on, I give up!)
2) VB.Net doesn't use default properties like VB "Proper" did.
So,when you now talk about RadioButton1, you really /are/
talking about the RadioButton /itself/, not the Checked property.
In fact, VB did actually tell you this in the Exception:
> Additional information: Operator is not valid for Boolean
> and RadioButton (or CheckBox).
blnGetAllFolders = RadioButton1.Checked
will work rather better.
HTH,
Phill W.
|