Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# question - how to tell if checkbox is checked?
Message
De
24/03/2008 19:00:45
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01305128
Message ID:
01305162
Vues:
9
Just remember, as Naomi pointed out, a boolean check requires "==". "==" means check for equality, "=" means assign. And you won't ncessarily get an error message if only use 1 equal sign.




>Actually I tried that and I get a syntax error '(' expected....
>
>maybe I need a THIS for THISFORM or something like that in front of it?
>
>>Sooooooooooooooooooo close!
>>
>>"Checked" is a property. So no "()". Parentheses necessary for method calls.
>>
>>
>>>Yippie! My first .NET question! (and yeah its realllly lame too .. haha)
>>>
>>>I have a checkbox I put on a form, and I'm trying to tell if it's been checked or not. I have something like this:
>>>
>>>if (dlgOpen.ShowDialog() == DialogResult.OK)
>>> {
>>> // Console.Write(dlgOpen.FileName);
>>> crystalReportViewer1.ReportSource = dlgOpen.FileName;
>>> if chkAutoRequery.Checked() = true
>>> {
>>> crystalReportViewer1.RefreshReport();
>>> }
>>> }
>>>
>>>
>>>chkAutoRequery is the name of my checkbox - so its this line:
>>> if chkAutoRequery.Checked() = true
>>>..that I'm doing wrong. Anyone clue me in on the correct syntax?
>>>
>>>Thanks!

(On an infant's shirt): Already smarter than Bush
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform