Microsoft KB Archive/326701

= PRB: &quot;Invalid Procedure Call or Argument&quot; Error Message When You Call the Invalidate Method of Windows Forms Control =

Article ID: 326701

Article Last Modified on 12/28/2002

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer

-



This article was previously published under Q326701



SYMPTOMS
When you call the Invalidate method of a Windows Forms control that is hosted on Microsoft Internet Explorer, you may receive following error message:

Error: Invalid procedure call or argument



CAUSE
The control has multiple overloaded Invalidate methods. Because the type libraries do not support multiple methods with the same name, the multiple methods are appended with suffixes such as &quot;_2&quot; and &quot;_3&quot;. In this case, the Invalidate method with the signature &quot;void Invalidate&quot; or &quot;sub Invalidate&quot; is represented as Invalidate_3. Depending on the parameters, Internet Explorer cannot resolve the suffix of the Invalidate method automatically.



RESOLUTION
To resolve this problem, use Invalidate_3 instead of the Invalidate method.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior
 Create a new Windows Control Library project named MyUserControl by using either Microsoft Visual C# .NET or Microsoft Visual Basic .NET. By default, UserControl1 appears in the Designer pane. Drag a TextBox control from the Toolbox to UserControl1. On the Build menu, click Build Solution to create MyUserControl.dll. Open Notepad or any other text editor.  Paste the following code in the text editor: function Click {              myUserCtl1.Invalidate; window.alert(&quot;Success&quot;); }       Custom User Control <object id=&quot;myUserCtl1&quot; classid=&quot;MyUserControl.dll#MyUserControl.UserControl1&quot; height=&quot;300&quot; width=&quot;300&quot; VIEWASTEXT> <input type=&quot;button&quot; value=&quot;Button1&quot; onclick=&quot;Click&quot; ID=&quot;Button1&quot; NAME=&quot;Button1&quot;> </li> Save the text file as Testpage.html.</li> In the root directory of your Web server, create a folder named TestUserControl. For example, the path of your folder may be C:\Inetpub\Wwwroot\TestUserControl.</li> Copy MyUserControl.dll and TestPage.html in the TestUserControl folder.</li> Open Internet Explorer, and then type Http://WebServer/TestUserControl/TestPage.html in the address bar, where  is the name of your Web server.</li> Click Button1. You receive the error message that is described in the &quot;Symptoms&quot; section.</li> In a text editor, open TestPage.html from the TestUserControl folder.</li> Change myUserCtl1.Invalidate to myUserCtl1.Invalidate_3.</li> Save TestPage.html.</li> Repeat steps 10 and 11. You receive a success message.</li></ol>

<div class="references_section">