Click to See Complete Forum and Search --> : [RESOLVED] Implicit conversion - is it an Error ?
JohnSavage
Jul 23rd, 2007, 05:52 AM
I am using a standard messagebox but have an error that says
“Implicit conversion from ‘Integer’ to ‘Microsoft.VisualBasic.MsgBoxStyle’ and when I go to the error by double clicking on the error message then ‘vbCritical+vbOKonly’ is highlighted.
What’s that all about and what should I do about it if anything:confused:
szlamany
Jul 23rd, 2007, 06:09 AM
Show your code...
I just ripped this out of a small ppc app we have...
Select Case MessageBox.Show("Do you really want" _
& Microsoft.VisualBasic.ControlChars.NewLine _
& "to re-sync?", "Re-sync" _
, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
Case Windows.Forms.DialogResult.No
Exit Sub
End Select
JohnSavage
Jul 23rd, 2007, 06:28 AM
Here it is with the text shortened
MsgBox("WARNING!" & vbCrLf & "You ………" & vbCrLf & "Also…….." & vbCrLf & "THIS……" & "" & vbCrLf & "Your….", vbCritical + vbOKOnly, "Copy……")
:confused: :confused: :confused:
szlamany
Jul 23rd, 2007, 07:40 AM
Here it is with the text shortened
MsgBox("WARNING!" & vbCrLf & "You ………" & vbCrLf & "Also…….." & vbCrLf & "THIS……" & "" & vbCrLf & "Your….", vbCritical + vbOKOnly, "Copy……")
:confused: :confused: :confused:Why are you using the old MSGBOX function?
Try switching to the true .Net function. Maybe the CF doesn't like MSGBOX (although I could not find that to be indicated in the help file)
brad jones
Jul 23rd, 2007, 07:43 AM
Here it is with the text shortened
MsgBox("WARNING!" & vbCrLf & "You ………" & vbCrLf & "Also…….." & vbCrLf & "THIS……" & "" & vbCrLf & "Your….", vbCritical + vbOKOnly, "Copy……")
I copy and pasted your code to a button event in a Pocket PC application for Visual Studio 2005. It compiled and ran fine in the Pocket PC 2003 emulator.
I agree that using the .NET Framework MessageBox class makes more sense.
Brad!
jmcilhinney
Jul 23rd, 2007, 07:56 AM
That error arose because you were using the addition operator "+", so the result was an Integer. You should have been using the bitwise Or operator so the result was still a MsgBoxResult value. That said, I'll throw my weight behind the suggestion that you use MessageBox.Show and avoid Runtime functions where possible.
JohnSavage
Jul 23rd, 2007, 09:11 AM
Thanks Gents!
JohnSavage
Jul 23rd, 2007, 09:39 AM
I have used this which is a .Net example but
MessageBox.Show("Typical installation is strongly recommended.", "Install information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
I get the error
“Overload resolution fails because no accessible ‘Show’ accepts this number of arguments”
Why?
szlamany
Jul 23rd, 2007, 10:55 AM
Do you need the fifth argument that I have?
Shaggy Hiker
Jul 23rd, 2007, 03:13 PM
The MessageBox function in the CF has been restricted down to just two of the several overloads available in the full version. You DO need the fifth argument, or you need to get rid of a few.
szlamany
Jul 23rd, 2007, 03:18 PM
That's what I thought...
JohnSavage
Jul 24th, 2007, 08:06 AM
Many thanks AGAIN !!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.