473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Boolean variables or Windows.Forms checkboxes?

In the GUI application I am writing I have some checkboxes for various
settings. The code right now has internal boolean variables and the events
that are fired off on checkBox_CheckedChanged for different checkboxes
change those boolean variables, which are later used throughout the program
(if/else statements).

Looking at this, I could cut the overhead of storing and retrieving the
boolean value by just referring to checkBox1.Checked property each time I
need to find out the value.

Is there any overhead involved with accessing boolean properties of the
Windows Form (the values are accessed perhaps 10-50 times a second) as
opposed to storing the boolean internally as a variable?
--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com
Nov 16 '05 #1
1 2178
Alex,

Accessing the internal variable is probably much quicker. For the
checkbox, what most likely occurs is that a message is sent to the window to
determine the checked state. This requires more than a few function calls.

I'd recommend checking the field directly.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Alex Moskalyuk" <us****@moskalyuk.com> wrote in message
news:OZ**************@TK2MSFTNGP10.phx.gbl...
In the GUI application I am writing I have some checkboxes for various
settings. The code right now has internal boolean variables and the events
that are fired off on checkBox_CheckedChanged for different checkboxes
change those boolean variables, which are later used throughout the program (if/else statements).

Looking at this, I could cut the overhead of storing and retrieving the
boolean value by just referring to checkBox1.Checked property each time I
need to find out the value.

Is there any overhead involved with accessing boolean properties of the
Windows Form (the values are accessed perhaps 10-50 times a second) as
opposed to storing the boolean internally as a variable?
--
Alex Moskalyuk
_____________________________
http://www.techinterviews.com

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
0
by: Robert Love | last post by:
I am trying to save some boolean values from checkboxes using isolated storage. I am able to do strings and integers without a problem but I can't work out how to save boolean values without seeing...
27
by: thomasp | last post by:
Variables that I would like to make available to all forms and modules in my program, where should I declare them? At the momment I just created a module and have them all declared public there. ...
4
by: Joe HM | last post by:
Hello - I realize that there is no more IsMissing function in VB.NET but how can I have a boolean argument that is optional and in the code I need to determine whether it was passed it or not? ...
4
by: Ironr4ge | last post by:
Hi everyone, I am trying to open the form "Languages" with a diffrent record source to the "Contacts" form where I conducted the search or filter... . I was wondering whether there was a vba...
3
by: c2 | last post by:
hi, i face a problem when click the icon , my login will prompt this message String was not recognized as a valid Boolean See the end of this message for details on invoking just-in-time (JIT)...
14
by: tdahsu | last post by:
I have twenty-five checkboxes I need to create (don't ask): self.checkbox1 = ... self.checkbox2 = ... .. .. .. self.checkbox25 = ... Right now, my code has 25 lines in it, one for each...
4
by: Yitzak | last post by:
Have a query that is arregated into crosstab query, it is working correctly. select Yes as selected from tblname or select true as selected from tblname Produces -1 ( vba value of True) in...
1
by: sunil | last post by:
Hello, I have a boolean expression thats specified in pre/in/post fix notations, lets assume infix for the sake of this argument. The expression can be in any of the following forms: Form A:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.