Every single time I try to use a control from components on vb6, I put the code, I run the program, then when I try to open the same program in another day, its not working, its giving me the error :

Line 13: Class MSAdodcLib.Adodc of control Adodc1 was not a loaded control class.
Line 18: The property name _ExtentX in Adodc1 is invalid.
Line 19: The property name _ExtentY in Adodc1 is invalid.
Line 20: The property name ConnectMode in Adodc1 is invalid.
Line 21: The property name CursorLocation in Adodc1 is invalid.
Line 22: The property name IsolationLevel in Adodc1 is invalid.
Line 23: The property name ConnectionTimeout in Adodc1 is invalid.
Line 24: The property name CommandTimeout in Adodc1 is invalid.
Line 25: The property name CursorType in Adodc1 is invalid.
Line 26: The property name LockType in Adodc1 is invalid.
Line 27: The property name CommandType in Adodc1 is invalid.
Line 28: The property name CursorOptions in Adodc1 is invalid.
Line 29: The property name CacheSize in Adodc1 is invalid.
Line 30: The property name MaxRecords in Adodc1 is invalid.
Line 31: The property name BOFAction in Adodc1 is invalid.
Line 32: The property name EOFAction in Adodc1 is invalid.
Line 33: The property name ConnectStringType in Adodc1 is invalid.
Line 37: The property name Orientation in Adodc1 is invalid.
Line 39: The property name Connect in Adodc1 is invalid.
Line 40: The property name OLEDBString in Adodc1 is invalid.
Line 41: The property name OLEDBFile in Adodc1 is invalid.
Line 42: The property name DataSourceName in Adodc1 is invalid.
Line 43: The property name OtherAttributes in Adodc1 is invalid.
Line 44: The property name UserName in Adodc1 is invalid.
Line 45: The property name Password in Adodc1 is invalid.
Line 46: The property name RecordSource in Adodc1 is invalid.
Line 47: The property name Caption in Adodc1 is invalid.
Line 57: The property name _Version in Adodc1 is invalid.

Why is like this and how can I make these unloaded controls class, loadable, do I have to upgrade my vb6, I searched online, there are not so many good answers about this problem, which i find effective is that when I try to open a form which contains one or more controls from the components area, i should try to put the control in the tollBox before opening the form, I tried its function, but I want to know if there is a permanent solution about this problem.

Dani AI

Generated

Your form is listing a bunch of Adodc1 property names because VB6 failed to load the ADODC ActiveX control at design time. When that control is missing or not registered, VB just shows the persisted property text from the .frm and flags them as invalid. The control you need is MSADODC.OCX (Microsoft ADO Data Control 6.0). It is a VB6 runtime extended file and must be present and registered on the machine. (learn.microsoft.com)

A more permanent fix than toggling add-ins is:

  • Make sure MSADODC.OCX is registered.
  • Then open Project -> Components and tick "Microsoft ADO Data Control 6.0 (OLE DB)" before loading the form.

On 64-bit Windows, use the 32-bit regsvr32 in SysWOW64. Run an elevated Command Prompt and register the OCX explicitly:

%windir%\SysWOW64\regsvr32 %windir%\SysWOW64\MSADODC.OCX   // 64-bit Windows
%windir%\System32\regsvr32 %windir%\System32\MSADODC.OCX    // 32-bit Windows

If you get an error, confirm you launched the prompt as Administrator and that you used the SysWOW64 regsvr32 on 64-bit systems. (support.microsoft.com)

If you want to avoid this class of problem entirely, drop the ADODC control and use ADO in code. Add a reference to "Microsoft ActiveX Data Objects 2.x Library" and do your own connection/recordset management, e.g.:

Dim cn As ADODB.Connection, rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "your OLE DB connection string"
Set rs = New ADODB.Recordset
rs.Open "SELECT ...", cn, adOpenKeyset, adLockOptimistic

ADO lives in msado15.dll (ProgID prefix ADODB), and using it directly keeps your forms from breaking when an OCX is missing or mismatched. (learn.microsoft.com)

I found the solution on my own, I want to share this with others who may look here for an answer themselves too, Open the Visual Basic, and then go to Add-Ins, then Add-In Manager , find the vb6 Add-In Toolbar click on it, then on the load behavior, check the loaded/unloaded,and load on startup, the same find also Visual Component Manager 6.0 do the same check the loaded/unloaded and load on startup, now you can open any form which did not open before, and showed that nasty error
Line 13: Class MSAdodcLib.Adodc of control Adodc1 was not a loaded control class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.