Click here to Skip to main content
15,917,060 members
Everything / Boolean

Boolean

boolean

Great Reads

by matt warren
Stack overflow Tag engine - Part 3
by ASP.NET Community
The CheckBox server control accepts Boolean (true or false) input. When selected, its Checked property is true. Typically a check box is processed as
by ASP.NET Community
if(IsPostBack){Boolean fileOK=false;String fileExtention=System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();   //check file
by ASP.NET Community
Imports System.Net.MailPublic Shared Function SendMail(ByVal MailFrom As String, ByVal MailTo As String, ByVal MailSubject As String, ByVal

Latest Articles

by matt warren
Stack overflow Tag engine - Part 3
by ASP.NET Community
Imports System.Net.MailPublic Shared Function SendMail(ByVal MailFrom As String, ByVal MailTo As String, ByVal MailSubject As String, ByVal
by ASP.NET Community
if(IsPostBack){Boolean fileOK=false;String fileExtention=System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();   //check file
by ASP.NET Community
The CheckBox server control accepts Boolean (true or false) input. When selected, its Checked property is true. Typically a check box is processed as

All Articles

Sort by Score

Boolean 

3 Feb 2015 by CPallini
Because you are never using the input provided by the user, in your code.Try:static void Main(string[] args) { string gender; Console.WriteLine("Please enter your gender"); gender = Console.ReadLine(); if (gender == "female") ...
14 Oct 2013 by Richard MacCutchan
It's not totally clear what your problem is, but does this help?while (true){ Console.Write("What's the magic word? "); string word = Console.ReadLine(); if (word == "shazam") { Console.WriteLine("You guessed it!"); break; } else { ...
3 Feb 2015 by nagendrathecoder
The code is incorrect here.You are saving user input in a string variable and comparing bool variable male (which is always true).You need to compare on string variable like:if(gender == "Male") //print maleelse if(gender == "Female") //print femaleelse //print improper input
29 Jun 2022 by Patrice T
Quote: Does this one boolean need to be, or should it be initialized? This specific Boolean do not need to be initialized because its value is never used in this code. This code does exactly the same: HANDLE hDFile =...
11 Mar 2013 by Sergey Alexandrovich Kryukov
You need to understand that bool.TryParse can return false, which is not an "error" (what is it?), but an indication that input string contains something unexpected or is null. Expected are the capitalized strings "True" or "False".—SA
14 Jul 2014 by CHill60
As the others have suggested, in SQL Server you can use a datatype of BIT[^]See also SQL Data Type Mappings[^]Note that the database handlers built into .net should take care of any conversion for you. For example you can do something like this...SqlCommand cmd = new SqlCommand("insert...
9 Jun 2015 by F-ES Sitecore
bool is a compiler alias of System.Boolean, int is System.Int32 etc, so when you type just "bool", it is converted to "System.Boolean".https://msdn.microsoft.com/en-us/library/ya5y69ds(VS.80).aspx[^]Also I found the answer to your question in seconds by googling "bool vs system.boolean",...
27 Jul 2015 by stibee
Task t1 = new Task(() => IsPrime(numberBeingTested));
12 Sep 2016 by matt warren
Stack overflow Tag engine - Part 3
6 May 2018 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. Try it yourself, you may find it is...
24 Sep 2020 by CPallini
The argument of isdigit is supposed to be a character, but you are passing it a int variable. Assuming your code should really deal with numbers (that is integers) and not digits, you might re-write your program this way (note you don't need an...
10 Dec 2012 by Richard MacCutchan
Well you will have to save it somewhere, but I agree using a database seems a bit much for a single boolean value. You could look at the application configuration file or the registry. Understanding Section Handlers - App.config File[^] may help you decide.
11 Mar 2013 by Yvan Rodrigues
To check what's going on, use bool.Parse instead of bool.TryParse. If a FormatException is thrown, the value you are supplying is not equal to bool.TrueString or bool.FalseString (the test is case-insensitive).If ArgumentNullException is thrown, your value is null.Otherwise it should work.
6 May 2014 by CPallini
Some insight here: "comparison operator values C++" at Stack Overflow[^].
14 Jul 2014 by Abhinav S
Try these links -Configuring Parameters and Parameter Data Types[^]HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET[^]C# Stored Procedure with Parameter [^]
1 Oct 2014 by Richard MacCutchan
Some examplesif (LoggedIn()){ LoggedOn(); if (true) { GetMail(); }Makes not much sense, especially to someone trying to understand your program. A better idea would be something like:if (Login()) // the login method returns true or false, indicating...
12 Jan 2017 by Andy Lanng
Quote:BTW sorry for using gotos please dont flame meHa - two days and you already know everyone's biggest bug-bear ;)The toggle here: l1finished = !l1finished; is unnecessary. Just use l1finished = true;In the 'LevelMenu:' segment, you write out the "Level Menu" + 27 clear lines but...
10 Apr 2017 by Patrice T
Quote: Can anybody help me? Help you with what ? It is so simple that there is nothing other than the code. Note, you did not even gave us a correct statement. This is coding 101 level Generating all binary grid is about 1 or 2 lines, depending on what you want with each grid the code must fit...
5 Sep 2017 by Patrice T
Quote: Let's say F is a Boolean function that scores sentiment and returns -1 or 1. First of all, Boolean values are 0 for False and 1 for True. In computers, the usage to use 0 for False and non 0 for True. Quote: Short-circuit evaluation is a straight forward subject for lazy evaluation on...
19 Sep 2017 by OriginalGriff
We can't tell - too much depends on the content of your data, and when that code actually gets executed: and we have no control over that, nor can we test it here. So, its going to be up to you. Put a breakpoint on the first line in the function, and run your code through the debugger. Then...
12 Feb 2018 by OriginalGriff
There is no recursion in that code, nor is there a loop. There may be recursion or iteration within the CZKEM class, but we can't see it if there is. You do understand that recursion is calling a method (directly or indirectly) from itself, don't you? public int factorial(int x) { if (x...
6 May 2018 by Richard MacCutchan
You can go to The Java™ Tutorials[^] to learn some of the things you missed. Or, better still, go and talk to your teacher and ask for the missing notes.
24 Sep 2020 by k5054
You have: isdigit(array_size==false) This should be isdigit(array_size) == false Note the placement of the brackets.
24 Sep 2020 by Patrice T
I suspect you want to replace this while (isdigit(array_size==false)){ with this while (isdigit(array_size)==false){ But the logic of the loop look rather confuse. May be it is not a loop that you want.
5 Oct 2020 by CPallini
Try int sum_adjacent_values(int r, int c) { int sum = - position_array[r][c]; for (int i = -1; i = 0 &&...
26 Mar 2021 by Patrice T
Quote: Why can't C have a boolean function? Traditionally in C, booleans are handled as ints. True is any non 0 integer. False is 0.
7 Sep 2022 by OriginalGriff
Try changing this: if (MessageBoxDisplayed) To this: if (!MessageBoxDisplayed)
24 Jan 2024 by Dave Kreskowiak
Is there a function that will comb through a dataset and automatically append data for you based on columns values? No. You have to write the functionality yourself.
24 Jan 2024 by Richard MacCutchan
I notice that you have a;ready posted this question at Identify a boolean in large datasets in Python[^], and received a response. Please do not repost the same question.
20 Apr 2012 by A.Ebrahimi
I need to know how to check a Boolean value that is empty ( table with no data row). my code: ID="ImgCanInsert" runat="server" />when table is empty this function raise error. In code...
10 Dec 2012 by Sivakrishna Reddy
Hello,I am developing a system application. I have a requirement that a boolean value to be remembered on application restart without the usage of database.Is it possible to remember any value without storing/saving it into database?If YES, Could you please elaborate the...
10 Dec 2012 by AnkitGoel.com
You have to create a text file/ xml file/ .Net config file to store required information and save it in app directory. Then you have to read it on app startup and use it wherever you need it. please let me know it helped or not?
20 Mar 2013 by Shraa1
I want to get the value from a DataGridViewCheckBoxCelli have tried various codesDataGridView1.Item(1, i).Value = False ThenalsoDataGridView1.rows(i).cells(1).Value = False Thenalso using ctype and cbool and convert.boolean...When i got into debug, when i move the mouse...
11 Oct 2013 by ASP.NET Community
The CheckBox server control accepts Boolean (true or false) input. When selected, its Checked property is true. Typically a check box is processed as
11 Oct 2013 by ASP.NET Community
if(IsPostBack){Boolean fileOK=false;String fileExtention=System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();   //check file
11 Oct 2013 by ASP.NET Community
Imports System.Net.MailPublic Shared Function SendMail(ByVal MailFrom As String, ByVal MailTo As String, ByVal MailSubject As String, ByVal
14 Oct 2013 by Member 10335511
Well, I know the basics of code. like how to use Console.WriteLine and ReadLine. I know how to set a string value using console.readline. I've already created a program that asks for a name, gender and age and then displays it. But what I really want to know is how to make a program that tells...
6 May 2014 by EbolaHost
Well...False is 00000000 so true must be 11111111=-1 in decimal system(255 unsigned)In all of the other programming languages I know(not many) true is equal to -1 which makes more sense...how can NOT(FALSE) be something else than NOT(00000000) ?Thank you !!
1 Oct 2014 by jake2809
First I apologize for my newness to coding, I am trying to make a simple gmail application that will allow the user to sign in with their gmail account and see if they have any mail. My issue is that when I prompt the user to sign in, it never verifies that they have signed in, either the window...
1 Oct 2014 by jake2809
So this is what I have so far, after being awake for 21 hours straight(currently approx 5AM CST) I am completely befuddled, So if it is all possible to show me what I have done wrong I would greatly greatly appreciate it. I feel that there is definitely something incorrect with my boolean method...
6 Nov 2014 by chandra sekhar
I am assigning value to a bool value likepublic bool Isoverhung=false;and i am fetching the value likeclass.Isoverhung=_presenter.Getthevalue();But i am getting null reference exception how can i solve this?
6 Nov 2014 by Mukesh Ghosh
_presenter.Getthevalue(); Must be return undefine Value.Check like convert.tobool(_presenter.Getthevalue())
6 Nov 2014 by DamithSL
class.Isoverhung=_presenter.Ge...
6 Nov 2014 by VC.J
try this ternarry operatorbool outValue;class.Isoverhung=bool.TryParse(_presenter.Getthevalue(),out outValue)?outValue:default(bool);
6 Nov 2014 by Laiju k
class.Isoverhung=_presenter.Ge...
27 Jul 2015 by Kyle Gottfried
IsPrime returns bool.Task t1 = new Task(IsPrime(numberBeingTested));
10 Nov 2015 by George Jonsson
Some reading to help you do your homework.http://www.math.northwestern.edu/~mlerma/courses/cs310-04w/notes/dm-propositions.pdf[^]http://www.cs.utexas.edu/~eberlein/cs301k/propLogic.pdf[^]
23 Mar 2016 by Member 11408361
I'm making a Student Information System where a student can enter there results and calculate their final grade overall. In the group box "Project Results" students enter there project results out of 50 and their percentage is calculated in TextBox1. However I want to include checkboxes to suit...
22 Mar 2016 by Richard Deeming
Try:If IsNumeric(TextBox3.Text) AndAlso CheckBox2.Checked ThenThe Checked property returns a Boolean. You were converting that to a string, and then attempting to use it as a Boolean. By removing the .ToString, you leave it as a Boolean, which can be used in a conditional...
22 Mar 2016 by F. Xaver
in Addition to Richards Solutionthe & in VB is for string concatenationin VB the AND Operator ist simply And and short-circuit AndAlsosimmilar Or and OrElseAlso IsNumeric is old and normal you want to use TYPE.TryParse of the specific type you want.and are you sure about...
23 Mar 2016 by Vignesh Mani
Using following methods in C#bool val;string input;input = bool.TrueString;val = bool.Parse(input);Console.WriteLine("'{0}' parsed as {1}", input, val);
21 Sep 2016 by H.AL
I am calling a SOAP webService from oracle which is returning xml responseI am trying to catch the boolean value using xmlTable as here but my code is returning parsing error which i cannot catch. Any hint? Below is my code:FUNCTION XMLTEST (P_XML VARCHAR2) RETURN VARCHAR2 AS V_FLAG...
21 Sep 2016 by H.AL
Solved, the problem was with xmlns=".."FUNCTION XMLTEST (P_XML VARCHAR2) RETURN VARCHAR2 AS V_FLAG VARCHAR2(4000); V_XML1 VARCHAR2(4000); V_XML2 VARCHAR2(4000); V_XML VARCHAR2(4000); ...
12 Jan 2017 by GrabiCraft
Why does this code not work? It seems that something is wrong with the swtitch bool thingy because I dont anything. When I run the program (this isnt the whole program by the way please comment if you need it to solve the problem) and finish all levels including the boss level I just get the...
11 Mar 2017 by Member 13050643
I have the following code and i don`t understand why P4(3,7)is giving returnvalue true (1) , since here 7(ConTemp.XYCoord[1]) is bigger than 5 (ReCoordRo.XYCoord[1]), so i would like to know a way to monitor the boolean Rechteck1.contains(P4), watch windows doesnt give me that option, so how do...
10 Mar 2017 by OriginalGriff
Um.Look at your contains method: bool contains (Rechteck &){ if (1){ return true;} else return false; }It always returns true because 1 is a non-zero constant and any nonzero value is "true" in C / C++
11 Mar 2017 by Member 13050643
Problem solved !It actually works looked like i just mistook Rechteck1.ReCoordLu.setupCoord(3,3)withRechteck1.ReCoordRo.setupCoord(9,9)
11 Mar 2017 by Patrice T
When you don't understand what your code is doing or why it does what it does, the answer is debugger.Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it...
6 Aug 2017 by Learn.net37
hello, I have a problem with Combine two condition down below, I try many things to use that two condition together but it didn't work, if someone can help me or have some way to solve this I will be hopeful Thanks.. What I have tried: if (e.Row.RowType == DataControlRowType.DataRow) {...
6 Aug 2017 by OriginalGriff
The problem is that "&&" is a boolan operation, and so is "==" - but no combination of operator precedence ends up with the same types on each side of both opertors: (Color.Red && Amount) == 0 is comparing a bool to an int. Color.Red && (Amount == 0) is comparing a Color to a bool. So the...
7 Aug 2017 by Graeme_Grant
Do you mean: if (e.Row.RowType == DataControlRowType.DataRow) { //put your control name here to get and then check for your value Label lbl = e.Row.FindControl("Label17") as Label; if (lbl.Text == "ملغي Cancled ") { e.Row.BackColor = Color.Red; Amount = 0; ...
6 Aug 2017 by Patrice T
e.Row.BackColor = Color.Red && Amount == 0; // -----> Problem is here Yes, this code is meaningless, so there is no possible correction because you didn't told us what it is supposed to do. Quote:I have a problem with Combine two condition down below Color.Red is not a condition....
5 Sep 2017 by Abderrahim Ben
Short-circuit evaluation is a straight forward subject for lazy evaluation on Boolean expressions, I noted that two factors could be useful for ordering Boolean functions to gain run-time. But this is applicable in a particular hypothesis: Knowing a percentage of positive (hence negative)...
19 Sep 2017 by Member 13418406
double avgToFinalLetterGrade, totalKnownGradeWeight, finalOverallScore; finalOverallScore = 0; if (desiredGrade == "A" || desiredGrade == "a") { finalOverallScore = 90;} else if (desiredGrade == "B" || desiredGrade == "b") { finalOverallScore = 80; } else if (desiredGrade ==...
19 Sep 2017 by phil.o
I would go for a switch statement rather than a bunch of if...else statements. Something like: switch (desiredGrade.ToLower()) { case "a": finalOverallScore = 90; break; case "b": finalOverallScore = 80; break; case "c": finalOverallScore = 70; ...
19 Sep 2017 by Patrice T
That mean that desiredGrade value is not what you think. the only way to know what is what is to use the debugger, set a breakpoint and inspect desiredGrade value and length. There is a tool that allow you to see what your code is doing, its name is debugger. It is also a great learning tool...
20 Feb 2018 by Member 12758475
I defined a string data type and asked the user to enter their cell number, eg 1234567890. Now, how do I validate that input and check if and make sure the string consists of only numbers? What I have tried: I've just started. I have no idea what to try
20 Feb 2018 by F-ES Sitecore
The long answer is that you don't. Someone might want to space their number out like 0700 123 456 They might need to add a country code +44(0)700 123 456 They might want to add an extension +44(0)700 123 456 x789 If I was trying to enter my number into your site your restriction would...
20 Feb 2018 by #realJSOP
Depending on the type of number it is, you could use xxx.TryParse() (where "xxx" is the numeric data type in question). string x = "1234"; string y = "-1234"; string z = "12b34"; int value; if (int.TryParse(x, out value)) { // x is indeed a valid integer, so...
31 Jul 2018 by Member NFOC
I have given two strings the same values but still it's saying the condition is false. What I have tried: char s[] = "hello", t[] = "hello"; std::cout
31 Jul 2018 by Eric Lynch
You're comparing the address of the two character arrays, not their contents. Either switch to std::string or use strcmp, see discussion here: Comparing the values of char arrays in C++ - Stack Overflow[^]
31 Jul 2018 by Patrice T
This is because is not how string are compared. in s == t, you are comparing the addresses of both string, and they are always different.
9 Nov 2018 by TheBigBearNow
current error: Object reference not set to an instance of an object I was getting invalid cast exception error but i changed (int) to Convert.toInt32 and that went away. I go to debug it and the on my button click and the code runs all the way through not stopping at any of my breakpoints. The...
9 Nov 2018 by OriginalGriff
The debugger is pretty much the only way you will find this: if you aren't hitting the breakpoints, then either they aren't in the right place, or you are not debugging the code you are executing. So: try it again. Go to the "Debug" menu and select the "Exceptions..." menu item. In the...
12 Oct 2019 by Richard MacCutchan
The following simple test shows that a value of zero is considered as empty: $start = 0; if (is_null($start)) print "null: " . $start; if (empty($start)) print "empty: " . $start;
12 Oct 2019 by Luc Pattyn
$adoption = NULL; if (isset($_GET["adoption"])) $adoption = $_GET["adoption"]; :)
24 Sep 2020 by lock&_lock
I'm trying to understand while loop, and the difference when I put "!" and "false" as a condition because somehow they produced different result for me. I'm writing this very simple program to sum an array of numbers, and I want to check if...
24 Sep 2020 by Shao Voon Wong
isdigit() takes in ASCII character though the parameter type is integer. Just change the type of array_size from int to char should work. char array_size; ... cin >> array_size; ... while (isdigit(array_size)==false){... or char array_size; ......
5 Oct 2020 by Helin1
Program should print out the given values in array1 and print the second array as true or false. Array1 represents a boardgame where characters can stand at the different positions. The integers indicate how dangerous it is to stand at every...
4 Oct 2020 by OriginalGriff
Use nested loops, just as you do for array1, but instead of formatting a number as a string, use the java conditional (or ternary) operator: What is the conditional operator ?: in Java?[^] System.out.print(array2[row][col] ? "T" : "F");
12 Jan 2021 by sree Harish
I want to disable specific dates in the date picker using the props shouldDisableDates, but as it accepts only functions I have written a function but it is always return false. What I have tried: code
12 Jan 2021 by Sandeep Mewara
Quote: return dateInt.indluces(new Date(date)) Spelling of includes look incorrect Refer: JavaScript Array includes() Method[^] Quote: shouldDisableDate (day: DateIOType) => boolean => Disable specific date You can add like: import React...
26 Mar 2021 by ModerateHacker;
Hey, My Wi-Fi's been down and I haven't been on the computer lately. It's good to be back. So, you guys said a 'bool' function does not exist in C. However, upon a google search, I found it does. What exactly do you guys mean? Here's the code...
26 Mar 2021 by Greg Utas
C didn't originally have bool, and maybe it still doesn't. It would simply be defined as some kind of int, possibly unsigned, with #define false 0 and #define true 1. Just like NULL isn't a keyword either, but rather some #define thing. This is...
26 Mar 2021 by OriginalGriff
C still doesn't have bool/code> as a datatype - _Bool was added at C99, but if you look at the stdbool.h header file, you will find that bool is a #define, as are true and false: /*===---- stdbool.h - Standard header for booleans...
26 Mar 2021 by Rick York
I see that old function is still alive and still in the wrong place as it was the last time you posted a question. You still have not learned C does not support nested functions. This was pointed out in your last question. That function was...
29 Jun 2022 by Member 15078716
Just this one boolean. Not a general question. A general guide would be helpful for later, but I am specifically wanting this one at this time. I have tried initializing it, but I am not certain if that is necessary or if it might cause...
23 Jan 2023 by FreedMalloc
Your write-up tells you exactly what to do: Quote: ...We declare a Boolean variable pressureOK for this purpose. boolean pressureOK We initialize it with true and set the value to false if a tire is outside the valid range. At the top of...
15 Mar 2023 by Tiaan 2023
I want to save a bool value (The value is already made in my Firebase Realtime Database whith a default value of false), but when I save the value it doesn't save. I follow the videos I use their code examples (modified to work for my code ofc)...
3 Feb 2015 by Leo Chapiro
>But when I executed this code, return male , why?You don't evaluate the input string but only the "bool male" that is allways true!Try this: static void Main(string[] args) { //bool male=true; string gender; Console.WriteLine("Please...
20 May 2011 by Apriorit Inc
This article describes the development of the library for performing text search based on Boolean search queries.
29 Jun 2022 by merano99
Return values ​​do not have to be initialized (for the compiler). But it's not a mistake if you do it. It might help when debugging if all variables have defined values. As Patrice has already written, return values ​​should also be checked if...
21 Apr 2012 by A.Ebrahimi
I have change it in this way and now it is running: " id="ImgCanInsert" runat="server" xmlns:asp="#unknown" />also code...
12 Jan 2017 by Patrice T
Thanks to the goto's, it is impossible to know what your code do without the whole program, the only advice is to learn to use the debugger.You should learn to use the debugger as soon as possible, it is an incredible learning tool. Rather than guessing what your code is doing, It is time to...
12 Jan 2017 by Alex Banu
to read input try like this:int op = 0;string in = string.Empty;do{ Console.WriteLine("enter choice"); in = Console.ReadLine();} while (!int.TryParse(in, out op));
3 Feb 2015 by goksurahsan
I want to print my gender using bool and if . And I wrote that codesstatic void Main(string[] args) { bool male=true; string gender; Console.WriteLine("Please enter your gender"); gender = Console.ReadLine(); if...
6 May 2014 by Kornfeld Eliyahu Peter
Wikipedia:The comparison operators ('>', '==', etc.) are defined to return a signed integer (int) result, either zero (for false) or 1 (for true)
29 Jun 2022 by Greg Utas
bErr doesn't need to be initialized, because it's never used until it stores the result from WriteFile. But if you want to initialize it, initialize it to false, not 0. Unless you disable compiler warnings, the compiler will tell you if you're...
14 Jul 2014 by Member 10945412
I have written code to tell if something has been processed. Now I just need to code something that sends a boolean from my code in C# to my table in SQL. It seems like it should be simple, but I am very new and can't figure it out, and Google hasn't turned anything out for me yet.I thank...
20 Mar 2013 by lg21155
It depends on weather your checkbox is in a checkboxfield or a template field. This page has more info.http://forums.asp.net/t/1023839.aspx