c# - checkBox1.Checked throwing an error -


new c# , visual studio. when testing line:

string mystring = (checkbox1.checked) ? "it's checked" : "not checked"; 

i following error.

error 1 event 'system.windows.controls.primitives.togglebutton.checked' can appear on left hand side of += or -=

this when playing wpf application. following video tutorial , in demo worked perfectly. might have been using windows forms.

edit:

string mystring = (checkbox1.ischecked) ? "it's checked" : "not checked"; 

throws error

error 1 'system.windows.controls.checkbox' not contain definition 'ischecked' , no extension method 'ischecked' accepting first argument of type 'system.windows.controls.checkbox' found (are missing using directive or assembly reference?)

or error

error 1 cannot implicitly convert type 'bool?' 'bool'. explicit conversion exists (are missing cast?)

checked event. need use ischecked property this...

string mystring = checkbox1.ischecked ? "it's checked" : "not checked"; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -