|
-
Jul 23rd, 2007, 05:52 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Implicit conversion - is it an Error ?
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
-
Jul 23rd, 2007, 06:09 AM
#2
Re: Implicit conversion - is it an Error ?
Show your code...
I just ripped this out of a small ppc app we have...
Code:
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
-
Jul 23rd, 2007, 06:28 AM
#3
Thread Starter
Fanatic Member
Re: Implicit conversion - is it an Error ?
-
Jul 23rd, 2007, 07:40 AM
#4
Re: Implicit conversion - is it an Error ?
 Originally Posted by JohnSavage
Here it is with the text shortened
Code:
MsgBox("WARNING!" & vbCrLf & "You ………" & vbCrLf & "Also…….." & vbCrLf & "THIS……" & "" & vbCrLf & "Your….", vbCritical + vbOKOnly, "Copy……")

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)
-
Jul 23rd, 2007, 07:43 AM
#5
Re: Implicit conversion - is it an Error ?
 Originally Posted by JohnSavage
Here it is with the text shortened
Code:
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!
-
Jul 23rd, 2007, 07:56 AM
#6
Re: Implicit conversion - is it an Error ?
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.
-
Jul 23rd, 2007, 09:11 AM
#7
Thread Starter
Fanatic Member
Re: Implicit conversion - is it an Error ?
-
Jul 23rd, 2007, 09:39 AM
#8
Thread Starter
Fanatic Member
Re: [RESOLVED] Implicit conversion - is it an Error ?
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?
-
Jul 23rd, 2007, 10:55 AM
#9
Re: [RESOLVED] Implicit conversion - is it an Error ?
Do you need the fifth argument that I have?
-
Jul 23rd, 2007, 03:13 PM
#10
Re: [RESOLVED] Implicit conversion - is it an Error ?
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.
My usual boring signature: Nothing
 
-
Jul 23rd, 2007, 03:18 PM
#11
Re: [RESOLVED] Implicit conversion - is it an Error ?
-
Jul 24th, 2007, 08:06 AM
#12
Thread Starter
Fanatic Member
Re: [RESOLVED] Implicit conversion - is it an Error ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|