Jump to content

References msdatasrc is already set - error CS0012


Recommended Posts


thanks for this nice piece of Software.

I've got a problem at step 2. Resolve References:

This reference 831FDD16-0C5C-11D2-A9FC-0000F8754DA1 I didn't find in my .vbp-file.

I've solved this with a reference to MSCOMCTL.ocx.

After that every things works fine :-)

But after the start of visual studio 2017 I got a problem with the references as you see in the last screenshot.

Error Code: CS0012

Error Description: The type "DataSource" isn't defined in one of the referenced assemblies. Add a reference on the assembly "Interop.MSDATASRC", Version, Culture=neutral, PublicKeyToken=null"

This reference is already set (see on the right side).

The problem is located on the data-comboboxes.

What I have to do to solve this problem?

Every support is appreciated.

Thanks a lot!







Link to comment
Share on other sites

  • Mobilize.Net Staff


In screenshots 3 and 4, there are two issues that have to be solved manually.

1. The first is related to MSComDlg objects. In vb6 there exist only one single dialog object with several functionalities: print dialog, color dialog, open file dialog, etc. In .Net there are specific dialog objects according to their functionality. For instance, there is a openfile dialog, print dialog, etc. The VBUC tool converts every MSComDlg object into their respective equivalences in .Net, so if you find a single MSComDlg object in your VB6 form, the upgraded form in .Net would have as many .Net dialog objects as functioanlities detected in the original application. However, for non upgraded library elements of the original MSComDlg , it will create a stub class called UpgradeStubs.AXMsComDlg_AXCommonDialog. This stub class may reference enums or types defined in the MSComDlg Activex component.

To avoid the error in screen 3 there are two paths:

b. Verify what are the nn-upgraded elements for the UpgradeStubs.AXMsComDlg_AXCommonDialog instance created in that form and replace them by .Net functionality.

a. Include a reference to the MSComDlg object and then perform (a).

2. In regards with the second issue (screenshot 4), the error is generated because rst that is declared as object and in runtime it's created as ADORecordsetHelper (implementation of a .Net DataSet) is being cast to msdatasrc.DataSource and that casting is incorrect because msdatasrc .DataSource is an unmanaged type while ADORecordsetHelper  is a .Net type.

What is the datatype for cboTeileNr? I looks like it's an Activex object.





Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use