my checkboxes are null references

Created at 13 Dec 2023, 09:36
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CT

ctid4921325

Joined 18.11.2023

my checkboxes are null references
13 Dec 2023, 09:36


hey there,

 

At one point in my code I have this:

 



            var chkboxSells = new CheckBox
            {
                Text = "Sells",
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                IsChecked = false
            };

and later on i have this..

 

 

var includeSells = chkboxSells.IsChecked;

 

but i've also tried this and a  zillion variations..

           var includeSells = chkboxSells != null && (bool)chkboxSells.IsChecked;

 

in the first attempt i get crashes due to null object references, and in the 2nd I can never get a checkd result to come through as true

Can anyone help me understand how to handle this?


@ctid4921325
Replies

firemyst
15 Dec 2023, 07:46 ( Updated at: 15 Dec 2023, 14:58 )

Duplicate:

 

https://ctrader.com/forum/calgo-support/42506

 


@firemyst