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

Correct way to combine MsgboxStyles

Hello Everyone.
I have a basic VB.NET question (again).
I found people using various ways to combine MsgboxStyles in VB.NET. For example:
Expand|Select|Wrap|Line Numbers
  1. MsgBoxStyle.Question + MsgBoxStyle.YesNo
  2. MsgBoxStyle.Question Or MsgBoxStyle.YesNo
  3. MsgBoxStyle.Question | MsgBoxStyle.YesNo
  4.  
All seem to work. Which one is the right way to follow ? I searched this on MSDN and reached:
http://msdn.microsoft.com/hi-in/libr...s,loband).aspx
But this does not seem to tell how to combine the styles.

Thank you in advance,
Parag Doke
May 28 '09 #1
4 6879
nukefusion
221 Expert 100+
Hi paragpdoke,

The MsgBoxStyle is an enumeration defined with the Flags attribute. That means you should use bitwise operations against them rather than arithmetic operations.

In terms of the examples you've posted I would say the first one is incorrect as it uses an arithmetic operator. That would probably give you the underlying integer values of MsgBoxStyle.Question and MsgBoxStyle.YesNo added together, which may or may not equate to another member of the enumeration, which, although allowed, is more than likely not what you're looking for.

Not that knowledgeable on VB, but the second one looks like VB syntax and would be equivalent to the third one which looks like C# syntax. Both OR the two flags together.

Of course you can always AND the flags together. This would use "And" in VB or the & operator in C#.

It may be worth looking up some resources on Bitwise operators and how they work in both VB and C#.

Hope this helps. :)
May 29 '09 #2
Hello nukefusion.
Yes, your reply definitely helps.
Thank you for taking out the time to share the information.

Regards,
Parag Doke
May 29 '09 #3
ChipR
1,287 Expert 1GB
The values of the MsgBoxStyle enumeration are shown here: MsgBox Function. They are designed such that they may be added together.
Jun 1 '09 #4
Thank you ChipR for the link.

Regards,
Parag Doke
Jun 1 '09 #5

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

Similar topics

3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
1
by: William Stacey [MVP] | last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ rooted path (similar to a VDir in IIS). Path.Combine alone will not do the job in all cases. I also need to be sure...
1
by: David Lozzi | last post by:
Hello, I'm looking for the best option to combine two XMLDocuments into a single document. I'm using ASP.Net using VB. I have a function that returns a dataset in XML which works great if there...
5
by: jhutchings | last post by:
Hello everyone, I have a database where I collect shipment data from various tables. However, I have a problem. Whenever I want to see shipping data for orders that were set to ship on or before...
3
by: Schroeder, AJ | last post by:
Hello group, I am a relative PHP newbie and I am trying to combine two arrays together, but I also need to keep the keys of one array intact. What I am doing is two SNMP walks against a Cisco...
2
by: nugz | last post by:
I want to combine 3 tables with like data then append it with a filter. Tables: NewStarts, Complaints, Memos Combine: Date, Address, Route, Pub, etc.... Then sort: previous 8 days, pub/freq...
3
by: Steven Bethard | last post by:
Within a larger pyparsing grammar, I have something that looks like:: wsj/00/wsj_0003.mrg When parsing this, I'd like to keep around both the full string, and the AAA_NNNN substring of it, so...
5
by: Rodjk #613 | last post by:
Hello, I am working with a database that is in use in several locations. The structure of the databases are identical, but the data is different. I am tasked with combining the data into one...
1
by: LSGKelly | last post by:
Hi all. I need to combine two fields that contain numbers that are in a currency format (Ex: $1,500 $3,500). When I combine them, I want them to look like this -- $1,500/$3,500. When I combine...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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

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.