Strange WndProc error in .Net. VB.Net more specifically

ETA: I am using Visual Studio 2008 Express Edition.

If I override WndProc and somehow messes up, I tend to discard the comments until it works again.

Strange thing with WndProc, although you can split it into:

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    MyBase.WndProc((m))
End Sub

      

and it still throws an error.

I need to remove the code and retype it to reset the error.

Has anyone else experienced this?

ETA:

Answered below by Chris Haas.

I didn't get it, but this problem only happened when I used the code from reflector. Reflector mis-translates to vb.net and inserts additional parentheses in calls to the WndProc base.

+2


a source to share


1 answer


When you complete the parenthesized argument, you override the call ByRef

and call it instead ByVal

. See Argument Not Changed By Procedure Call - Base Variable

Just change your code to:



Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    MyBase.WndProc(m)
End Sub

      

+4


a source







All Articles