BUG: You receive a "Class not registered" error message in Visual Basic 6.0 project after you remove Visual Studio .NET or Visual Studio 2005

Symptoms

You have Visual Studio .NET or Visual Studio 2005 installed on your computer. You create a Visual Basic 6.0 project that has a control that is bound to a data source. When you remove Visual Studio .NET or Visual Studio 2005 and then run you Visual Basic 6.0 project, you receive the following error message:
Run-time error '713':
Class not registered.
Looking for object with
CLSID:{59245250-7A2F-11D0-9842-00A0C91110ED}

Cause

This problem occurs because the Component Object Model (COM) based MSBind.dll is unregistered when you remove Visual Studio .NET or Visual Studio 2005. Visual Basic 6.0 uses MSBind.dll to bind the control to the data source. Therefore, when you run a Visual Basic 6.0 project that has a data-bound control, you receive the run-time error message.

Resolution

To resolve this problem, register MSBind.dll again. To do this, you can use the Regsvr32.exe tool or you can add the reference to your Visual Basic 6.0 project so that the DLL is registered automatically. To add the reference to your project, follow these steps:
  1. In Visual Studio .NET or in Visual Studio 2005, open your Visual Basic project.
  2. On the Project menu, click
    Add References.
  3. Click Browse, and then locate the
    MSBind.DLL assembly in the system32folder.
  4. Click MSBind.DLL, and then click
    Open.

    Note In Visual Studio 2005, you do not have to click Open.
  5. Click OK to apply the references to the project.
  6. On the Run menu, click
    Start.

Status

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

More Information

Steps to reproduce the behavior

  1. In Control Panel, click Add or Remove Programs. Click Microsoft Visual Studio .NET or Microsoft Visual Studio 2005, and then click Change/Remove.
  2. In the Setup wizard, click
    Uninstall Visual Studio .NET or Uninstall Visual Studio 2005.
  3. After you remove Visual Studio .NET or Visual Studio 2005, start a new
    Standard EXE project in Microsoft Visual Basic 6.0. By default, Form1 is created.
  4. In the Toolbox, double-click the
    CommandButton control, and then double-click the
    TextBox control.
  5. Add the following code to the Click event of Command1:
    Private Sub Command1_Click()
    Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset
    'Create the connection to the SQL Server.
    cn.Open ("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=YourUserId;Password=YourPassword;Initial Catalog=Northwind;Data Source=YourSQLServer")
    cn.CursorLocation = adUseClient
    cmd.CommandText = "select * from Products"
    cmd.ActiveConnection = cn
    'Run the SQL query in the Command Text.
    Set rs = cmd.Execute
    'Bind the TextBox to the Recordset rs.
    Set Text1.DataSource = rs
    Text1.DataField = "Productname"
    End Sub
    Note In the Connection String, replace
    YourSQLServer with the name of your local computer running SQL Server. Replace YourUserId and
    YourPassword with your SQL Server user ID and password.
  6. On the Project menu, click
    Add References.
  7. Click to select the check boxes for Microsoft Data Binding Collection and Microsoft ActiveX Data Objects 2.0 Library.
  8. On the Run menu, click
    Start.
  9. Click Command1.

References

For more information, visit the following Microsoft Web site:
Propriedades

ID do Artigo: 814707 - Última Revisão: 13 de mai de 2008 - Revisão: 1

Comentários