Integer Problem MsgBox parameter

Stormweaver1

Member
Joined
Jun 12, 2006
Messages
13
Programming Experience
Beginner
When I click on my picture in the "cave"

with this code
" System.Object, ByVal e As System.EventArgs) Handles PictureBox59.Click
MsgBox("You have the Kender spoon of turning!", " ")
Spoon = 1
End Sub
"

alright the msgbox is to tell you that you have finally found the quest item.

The problem is "An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from string " " to type 'Integer' is not valid."

so im assuming it thinks that my message box is an integer? I don't understand why though.

Can anyone fix my Problem?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,552
Location
Norway
Programming Experience
10+
The second parameter of the MsgBox function is the optional Buttons as MsgBoxStyle, which is an enumerated type, see the doc for values or use the Intellisense editor to get one.

You should also use the MessageBox class instead of the MsgBox function.
 
Top Bottom