Article ID: 832676
Article Last Modified on 4/25/2007
APPLIES TO
- Microsoft Visual Basic 6.0 Enterprise Edition
- Microsoft Visual Basic 6.0 Professional Edition
SYMPTOMS
When you use an Enum parameter in a Microsoft ActiveX control method that you create in Microsoft Visual Basic 6.0, you may receive the following error message if you run the application in the IDE:
You may receive the following error message if you run the application from a MS-DOS command prompt:
RESOLUTION
To resolve this problem, put the Enum parameter last in the parameter list, as follows:
In the UserControl1.ctl file, replace the following code
Public Sub GetUpdateInfo(ByVal UType As UpdateType, ByRef UpdateFiles() As UpdateInfo, ByRef uIndex As Integer) End Sub
with:
Public Sub GetUpdateInfo(ByRef UpdateFiles() As UpdateInfo, ByRef uIndex As Integer, ByVal UType As UpdateType) End Sub
In the UserControl1.ctl file, replace the following code
UserControl11.GetUpdateInfo UpdateType.utHRDat, uf, uindex
with:
UserControl11.GetUpdateInfo uf, uindex, UpdateType.utHRDat
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to reproduce the behavior
- Start Visual Basic 6.0.
- Create a new ActiveX Control project.
By default, the UserControl1.ctl file is created. Add the following code to the UserControl1.ctl file:
Option Explicit Public Type UpdateInfo FileName As String Register As Boolean FileSize As Long End Type Public Enum UpdateType utHRDat = 1 utHRUpdate = 2 End Enum Public Sub GetUpdateInfo(ByVal UType As UpdateType, ByRef UpdateFiles() As UpdateInfo, ByRef uIndex As Integer) End Sub
- On the File menu, click Make Project1.ocx.
The Project1.ocx file is created. - Create a new Standard EXE project.
By default, the Form1.frm file is created. - Add a CommandButton control to the Form1.frm file.
- On the Project menu, click Components to add the Project1.ocx file control to the Toolbox window.
The UserControl1 ActiveX control is added to the Toolbox window. - Add the UserControl1 control to the Form1.frm file.
Add the following code to the Form1.frm file:
Option Explicit Private Sub Command1_Click() Dim uf() As UpdateInfo Dim uindex As Integer uindex = -1 UserControl11.GetUpdateInfo UpdateType.utHRDat, uf, uindex MsgBox uindex End Sub
- On the Debug menu, click Start.
- In the Form1 window, click the Command1 button.
You receive one of the error messages that are mentioned in the "Symptoms" section of this article.
REFERENCES
For more information, visit the following Microsoft Web site:
Keywords: kbconsole kbcontrol kbbug KB832676