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

Changing YES AND NO VALUES

i got to hand my assigment in tomorrow on VB .NET all i basicly want to know is if their is anyway you can change the yes and no values. This would make my life so much easyer if you can! So i can have 1 and 0 instead of 6 and 7. Im sure my teacher told me it is possible but i cant seem to find anything on the web. if not ill post my complicated question and code tomorrow,lol

Cheers

Dave
Nov 2 '07 #1
8 1570
vanc
211 Expert 100+
i got to hand my assigment in tomorrow on VB .NET all i basicly want to know is if their is anyway you can change the yes and no values. This would make my life so much easyer if you can! So i can have 1 and 0 instead of 6 and 7. Im sure my teacher told me it is possible but i cant seem to find anything on the web. if not ill post my complicated question and code tomorrow,lol

Cheers

Dave
??? What are you saying about??? Please make it clear so someone can help you out here mate.

cheers.
Nov 2 '07 #2
debasisdas
8,127 Expert 4TB
Are you retriving the values from database ?
Nov 2 '07 #3
balabaster
797 Expert 512MB
??? What are you saying about??? Please make it clear so someone can help you out here mate.

cheers.
Sounds like you want to have the boolean values "yes" and "no" correspond with something other than 0 and 1 (although true seems to be represented by -1 these days instead of 1 which confuses things a little further). So you might want "yes" to equate to 6 instead of 1 and "no" to equate to 7?

The only way I can think of off the top of my head is by using the MsgBoxResult...the Yes button corresponds with 6 and the No button corresponds with 7 (coincidentally)...are you referring to that?

Try:

Dim i As MsgBoxResult =

scroll through the intellisense list - it will tell you what each different button corresponds to. Unfortunately it doesn't actually change the boolean values of True = 6 and False = 7...but you can store the values numerically effectively mimicking the effect you're looking for.
Nov 2 '07 #4
balabaster
797 Expert 512MB
Sounds like you want to have the boolean values "yes" and "no" correspond with something other than 0 and 1 (although true seems to be represented by -1 these days instead of 1 which confuses things a little further). So you might want "yes" to equate to 6 instead of 1 and "no" to equate to 7?

The only way I can think of off the top of my head is by using the MsgBoxResult...the Yes button corresponds with 6 and the No button corresponds with 7 (coincidentally)...are you referring to that?

Try:

Dim i As MsgBoxResult =

scroll through the intellisense list - it will tell you what each different button corresponds to. Unfortunately it doesn't actually change the boolean values of True = 6 and False = 7...but you can store the values numerically effectively mimicking the effect you're looking for.
Having come back to revisit this...it occurs to me that you may have wanted the yes and no buttons to equal 1 and 0 instead and not the other way around...I'm pretty sure the only way to do this would be something like this:
VB
Expand|Select|Wrap|Line Numbers
  1. Dim Result As Boolean = (MsgBox("This is stuff", MsgBoxStyle.YesNo) = MsgBoxResult.Yes)
C#
Expand|Select|Wrap|Line Numbers
  1. bool Result = (MessageBox.Show("This is stuff", MsgBoxStyle.YesNo) == MsgBoxResult.Yes);
This would effectively convert the answer from a YesNo message box to True/False or -1/0.

I'm pretty sure the MsgBox/MessageBox class is not inheritable so I can't think of another way you can do it...not to say there isn't one.
Nov 2 '07 #5
Plater
7,872 Expert 4TB
Quick fix:

C#
Expand|Select|Wrap|Line Numbers
  1. bool Result = (MessageBox.Show("this is text", "this is caption", MessageBoxButtons.YesNo) == DialogResult.Yes);
  2.  

Although, we're not supposed to help with assignments.
Nov 2 '07 #6
balabaster
797 Expert 512MB
Quick fix:

C#
Expand|Select|Wrap|Line Numbers
  1. bool Result = (MessageBox.Show("this is text", "this is caption", MessageBoxButtons.YesNo) == DialogResult.Yes);
  2.  

Although, we're not supposed to help with assignments.
Thanks for the fix...oversight on my part. Not even really sure that was what the question was about. He never confirmed...so I'm just answering assumptions. :oP
Nov 2 '07 #7
Plater
7,872 Expert 4TB
Thanks for the fix...oversight on my part. Not even really sure that was what the question was about. He never confirmed...so I'm just answering assumptions. :oP
According to the OP their project was due by "today" so they probably never came back
Nov 2 '07 #8
balabaster
797 Expert 512MB
According to the OP their project was due by "today" so they probably never came back
I always wonder about people who leave their assignments to the last minute like that. How do they ever expect to pass if they haven't taken the effort to know the fundamentals the night before the assignment is due?
Nov 2 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Cengiz Ulku | last post by:
Hi all, I know now how to change the font name of a RTF file in a RTB control using, for example: RTextBox1.SelFontName = cmbFonts.Text I have a RTF file -created with Word- displayed in a...
5
by: martin | last post by:
I needed a way to display calculated, multiple, changing values (numerical sums) as users interacted with the page, and do this without going back to the server to load the page again. What I...
3
by: Jeff | last post by:
Hi I have a report with a graph on it and want to change the minimum and maximum values for the value axis when it is previewed. This can't be done by adding code in the Open event as once the...
3
by: Jeremy Ames | last post by:
I have a form that contains two hidden values, among other controls. I was wondering, if I change these values in server script and immediately do a server.transfer, do these values get updated...
3
by: kurt sune | last post by:
I am running the native debugger in Visual Studio. I debug an assembly calling DLL:s made in VB6. I can watch the values of variables thus: ?Number 0x06e1960c "300115"
7
by: Jeffrey Spoon | last post by:
Hello, I'm a bit stuck trying to convert a text file which contains extended ASCII text and changing the ASCII values so they become readable. I do this by subtracting 127 from the ASCII value....
2
by: John | last post by:
Hi Everyone, I have a question about dynamically changing the length of a varchar(n) field, in case the value I'm trying to insert is too big and will give a "truncated" error, but before the...
1
by: sathyan8294 | last post by:
what is vb.net code for changing the values in datagrid and save the changed values using vb.net windows application
6
by: troy_lee | last post by:
I have a continuous form that has one combo box (cbo1) with the selectable values of "Removal" and "Installation". I would like to change another combo box (cbo2) value list based on the selection...
3
by: mileshenley | last post by:
Hey there, This may be an ASP question but i think it is more of a JS question. I have a web form that i want to have database values loaded into. I have (and want) the form defaulting to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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.