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

Option Strict problem

Hi

In this statement; If MsgBox("Are you sure you want to delete this record?",
MsgBoxStyle.OKCancel + MsgBoxStyle.Information, "Delete Record") =
MsgBoxResult.OK Then,

I am getting the "Option Strict On disallows implicit conversions from
'Integer' to 'Microsoft.VisualBasic.MsgBoxStyle'." error on the
MsgBoxStyle.OKCancel + MsgBoxStyle.Information part. What am I doing wrong?

Thanks

Regards
Nov 20 '05 #1
4 5542
Hi John,

When joining messagebox styles together you should be using the 'Or' bitwise
operator and not the addition operator...

MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel
Or MsgBoxStyle.Information, "Delete Record") = MsgBoxResult.OK Then

HTH,
Gary

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:uB*************@TK2MSFTNGP09.phx.gbl...
Hi

In this statement; If MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information, "Delete Record") =
MsgBoxResult.OK Then,

I am getting the "Option Strict On disallows implicit conversions from
'Integer' to 'Microsoft.VisualBasic.MsgBoxStyle'." error on the
MsgBoxStyle.OKCancel + MsgBoxStyle.Information part. What am I doing wrong?
Thanks

Regards

Nov 20 '05 #2
Hi John,

When joining messagebox styles together you should be using the 'Or' bitwise
operator and not the addition operator...

MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel
Or MsgBoxStyle.Information, "Delete Record") = MsgBoxResult.OK Then

HTH,
Gary

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:uB*************@TK2MSFTNGP09.phx.gbl...
Hi

In this statement; If MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information, "Delete Record") =
MsgBoxResult.OK Then,

I am getting the "Option Strict On disallows implicit conversions from
'Integer' to 'Microsoft.VisualBasic.MsgBoxStyle'." error on the
MsgBoxStyle.OKCancel + MsgBoxStyle.Information part. What am I doing wrong?
Thanks

Regards

Nov 20 '05 #3
John,
MsgBoxStyle is a Flag type enumeration and so use "OR" not "+".
Fred

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:uB*************@TK2MSFTNGP09.phx.gbl...
Hi

In this statement; If MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information, "Delete Record") =
MsgBoxResult.OK Then,

I am getting the "Option Strict On disallows implicit conversions from
'Integer' to 'Microsoft.VisualBasic.MsgBoxStyle'." error on the
MsgBoxStyle.OKCancel + MsgBoxStyle.Information part. What am I doing wrong?
Thanks

Regards

Nov 20 '05 #4
John,
MsgBoxStyle is a Flag type enumeration and so use "OR" not "+".
Fred

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:uB*************@TK2MSFTNGP09.phx.gbl...
Hi

In this statement; If MsgBox("Are you sure you want to delete this record?", MsgBoxStyle.OKCancel + MsgBoxStyle.Information, "Delete Record") =
MsgBoxResult.OK Then,

I am getting the "Option Strict On disallows implicit conversions from
'Integer' to 'Microsoft.VisualBasic.MsgBoxStyle'." error on the
MsgBoxStyle.OKCancel + MsgBoxStyle.Information part. What am I doing wrong?
Thanks

Regards

Nov 20 '05 #5

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

Similar topics

9
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
13
by: Cor | last post by:
Hi Option Strict gurus, Because of the so much given advises here to use Option Strict I did try to use that. But it gives an error and I don't know how to resolve that. The message is that...
11
by: Daylor | last post by:
hi. im using option strict on. im doing in ,from the simple reason ,to be warn when there are implict conversion like string to int ,int to string. BUT. the price ,(now i see ), is very bad....
17
by: David | last post by:
Hi all, I have the following problem: my program works fine, but when I add option strict at the top of the form, the following sub fails with an error that option strict does not allow late...
4
by: zacks | last post by:
A common programming technique I use in VB is making a collection of structures. But if Option Strict is on (which I would prefer), the .Add that adds the structure to the collection is flagged...
15
by: guy | last post by:
when i first started using .net (beta 1) i came across option strict and thought hey this could be really good, and since then have always turned it on, most people here seem to agree that this is...
4
by: John | last post by:
Hi I have a vs 2003 project which I have just imported into vs 2005. Now I am getting the "Option Strict On disallows operands of type Object for operator '='. Use the 'Is' operator to test for...
13
by: C. Moya | last post by:
I fully expected the lack of a way to set Option Strict globally to be fixed in SP1. I can't seem to figure out if it has been fixed or not. It still seems we have to add the declaration at the top...
6
by: Rob | last post by:
I have employed a "Singleton mode" of programming for this project. I have a class that exposes some properties of the class "Sample" to other forms.... If I set Option Strict On, I get many...
18
by: Poldie | last post by:
How do I turn it on? I'm using vb 2005 in visual studio 2005 sp1. In my web.config I have: <compilation debug="true" strict="true" /> In my Tools/Options/Projects and solutions/vb defaults...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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.