473,385 Members | 1,757 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,385 software developers and data experts.

How to let MessageBox display boolean value?

Tee
Hi,

I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error, "cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?
Thanks,
Tee
Nov 16 '05 #1
3 15054
You need to convert the bool to string, sport.
try
bVar.ToString()
Shane Sukul
BSC MCSD MCAD

"Tee" wrote:
Hi,

I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error, "cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?
Thanks,
Tee

Nov 16 '05 #2
Hi Tee!

"Tee" schrieb
I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error,
"cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?


//your boolean variable
bool myBool = false;

//use it in a MsgBox
MessageBox.Show(myBool.ToString());

Cheers

Arne Janning
Nov 16 '05 #3
Sport,

You need to convert the boolean to a string.

Try

boolVar.ToString();

With Regards
Shane Sukul
BSC MCSD MCAD

"Tee" wrote:
Hi,

I have a boolean variable, I need to see it's true or false from a
MessageBox.Show, but when I try to compile, I keep on getting error, "cannot
convert from 'bool' to 'string'". This is clear enough what's the problem,
but anyone know how to display a true/false in MessageBox?
Thanks,
Tee

Nov 16 '05 #4

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

Similar topics

0
by: Billy Jacobs | last post by:
You will need to use client side script to display a message box: The following code demonstrates the results of the alert using a hidden input box, and javascript. Do the following. 1....
1
by: Kevin R | last post by:
I'm running the HelloWorldForm example from Microsoft to learn how to use ..net. I'm using Microsoft Visual Studio .NET 2003, 1.1 framework. I run the HelloWorldForm example. The example runs...
13
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I...
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
7
by: MadCrazyNewbie | last post by:
Hey Group, Sorry to be a pain again but i have the following code: If MessageBox.Show("Are Your Sure You Want To Send This Email?", "Are Your Sure You Want To Send This Email?",...
6
by: Calligra | last post by:
have a form which looks at the title of the workbook saved on a different workbook, determines whether or not information has been inputted previously and then asks the user if the information is...
3
by: VMI | last post by:
I know this isn't the best group to post aspnet question, but the MS asp.net NG hasn't been very helpful lately. I've been trying to add a messagebox following the examples I've seen on the web,...
3
by: rdemyan via AccessMonster.com | last post by:
Sometimes users (including myself) accidentally click on the application close icon in the application menu bar when they meant to just click on the 'X' for the form. Of course the app closes and...
0
by: Tarazen | last post by:
Hi i have built a mobile phone in VB 2005.I am having difficulty getting it to send messages to another Form(another mobile phone image) I can get it to send a static message ie:if i type the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.