.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Reg Free COM Interop works with OCX but not with DLL

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :.NET Framework
Good afternoon, I'm having trouble turning a .NET EXE that invokes a VB6 COM DLL that invokes a .NET DLL into a side by side application.  I've created a COM Visible .NET DLL in .NET (called COMVisibleDotNetDLL.dll): <ComClass(TestClass.ClassId, TestClass.InterfaceId, TestClass.EventsId)> _ Public Class TestClass #Region "COM GUIDs" ' These GUIDs provide the COM identity for this class ' and its COM interfaces. If you change them, existing ' clients will no longer be able to access the class. Public Const ClassId As String = "e8b39720-c4a5-466e-b58d-6906026b6a1d" Public Const InterfaceId As String = "b3c49fd4-5adb-4d71-b5a0-e9d22d8b4b8c" Public Const EventsId As String = "f2b6e8a2-3344-4968-86c7-4cdcf07ab81d" #End Region ' A creatable COM class must have a Public Sub New() ' with no parameters, otherwise, the class will not be ' registered in the COM registry and cannot be created ' via CreateObject. Public Sub New() MyBase.New() End Sub Public Sub HelloWorld() MsgBox("This is COMVisibleDotNetDLL.TestClass.HelloWorld() saying ""Hello!""") End Sub End Class I've then created a VB6 COM DLL (called VB6DLLCallingDotNet.dll) that invokes this COM Visible .NET DLL: Public Sub CallDotNet() MsgBox "This is

View Complete Post

More Related Resource Links

Reg free COM and COM/.NET Interop


I have a native code app that uses COM/.NET Interop to a managed code assembly exposed as a COM object. Previously this was using the registry but I thought I'd explore using reg free COM. This is working correctly when the COM assembly is installed to the same location as the application. I was also looking to see whether the same assembly can be located in the GAC. The Sxs probing seems to search the old 2.0 GAC (\windows\assembly\GAC) folder but not the .NET 4 location (\windows\microsoft.net\assembly). So, if the .NET component has been built and GAC'd using .NET 2,3 or 3.5 the application works, but if targeted at .NET 4.0 the infamous application failed to start message appears. The sxstrace tool seems to confirm that the .NET 4 GAC is not searched and binding fails.

Curiously, if I start the application with the local assembly such that the application context succeeds, then *delete* the local file, the application continues to work and the assembly is loaded from the 4.0 GAC.

Ultimately the .NET assembly is likely to be installed locally, but I'm interested if anyone can explain the behaviour I'm seeing and whether sxs/GAC is something to be avoided?

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

COM Interop in C# 4.0

Let's take a bit of a recap of how far we've come. We've chatted about dynamic binding in C# and how that all plays in with the DLR, and about named and optional arguments and how they change the way methods are bound. The only other major piece in C# 4.0 is this notion of COM interop. We chatted about how dynamic really is a gateway to interop with different object models and languages (ie interacting with dynamic languages, dynamic object models, javascript objects, HTML DOM etc), but in C# 4.0, we want to go a bit further and provide you a few more tools to help make your interop life much easier.

Free Series of SharePoint Workflow How-to Videos

This is the series of "How to" Document Workflow with SharePoint using Visual Studio 2008 (using the .NET Framework 3.0 for backward compatibility to Visual Studio 2005). I have created video's that show the most common requests that I have seen around MOSS/SharePoint 2007 workflow & document workflow.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader

ActiveSync 4.5 (Free Down Load) using in Windows Mobile Pocket Pc

Microsoft ActiveSync 4.5 is the latest sync software release for Windows Mobile-powered devices. ActiveSync provides a great synchronization experience with Windows®-powered PCs and Microsoft Outlook right out of the box.


* Faster file transfer speed and photo sync via Outlook are only available for Windows Mobile 5.0 powered devices.
* Remote PC Sync (via WiFi or LAN) has been removed due to Enterprise customer feedback around security issues.
* Customers using Microsoft Exchange 2003 Service Pack 2 with devices running the Messaging and Security Feature Pack for Windows Mobile 5.0 will benefit from the following feature enhancements included in ActiveSync 4.5: Direct Push Technology, local device wipe, and certificate powered authentication to Microsoft Exchange.
* Microsoft® Outlook® 2000 is not supported by ActiveSync 4.5. It is highly recommended that users upgrade to Microsoft® Outlook® 2003 messaging and collaboration client.
* Conversion of database files for use on a mobile device is not supported by ActiveSync 4.5. On previous versions, this feature was limited to devices running Windows Mobile software for Pocket PC 2003 and earlier.
* Conversion of font files for use on a mobile device is not supported by ActiveSync 4.5. On previous versions, this feature was limited to devices running Windows Mobile software for Pocket P

Free BarCode Software

Bar Code Specifications

There are more than 300 different types of barcodes, all with their own specifications. You will find detailed specifications of many popular bar code symbologies and where you can order the official specifications here at BarCode-1.

Barcode-1 Specification Sources Page list the most popular barcodes. It has links to technical information and is a good place to start.
The UPC/EAN Barcode Page lists the details of UPC barcode, and EAN barcode, the type used in grocery stores.
UCC128, EAN128 and GS1-128 Page lists the details for this important standard for marking shipping cartons.
The Code 39 Barcode Page has the details for Code 39 barcode, the most popular barcode used in industrial application.
The Code 128 Barcode Page has the details for Code 128 barcode, a barcode that can encode the entire ASCII character set.
The Interleaved 2 of 5 (I 2 of 5) Barcode Page has the details of this popular barcode.
The NW-7 Barcode Page has the details about this popular barcode in Japan.
The Plessey Code Barcode Page has the details for the historically important barcode.
The 2D Barcode Page lists the most popular two dimensional barcodes. It has links to technical information and is a good place to start if you a looking for 2D barcode information.

The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or

The Free Barcode Creator produces barcode images one at a time, and allows easy saving to a file or pasting into an application. 2D versions are also available:

Free e-books Download

This is the link where we have get free e-books for downloading

Code works on aspx but not ascx


Not sure which category to put this question in, so I will put it in here.

Just to give you an idea of the layout of my solution, I have the main project, along with 2 class libraries, BLL and DAL.  (Business Logic Layer and Data Access Layer)

The BLL refers to the DAL and the main project refers to the BLL.

I had a test website and the code worked fine, but the same code will not work on the real project. The only difference is that in the test project, the code was on an aspx code behind, whereas in the real project, it is an ascx code behind (Web User Control )

The code is:

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString
        Dim recordEntry As New UserRecord(connectionString)
        recordEntry.UserName = "TestName"
        recordEntry.BMI = bMI
        recordEntry.BMR = bMR
        recordEntry.FTM = fTM
        recordEntry.TDEE = tDEE
        recordEntry.TodayDate = dateForToday

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString").ConnectionString

How can I be sure that my entire project is up-to-date and free of errors in VS2010?


Seems like a stupid question, but I will go to Build > Build Solution many many times and the build will succeed many many times, then I will put in a minor syntax error and the build will fail, BUT the build will not fail because of the minor syntax error; it will fail because of an unresolved type that I put in about twenty compiles ago. And then I will fix the minor syntax eror, and the compiler will still complain about the unresolved type. Here is my code:

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
  <form runat="server">
  Hello World!!  

Pretty simple, really. I go to Buld > Build WebApplication1 and it runs OK. Now, if I put in a minor syntax error, such as substitute "forrrrrrrm" for "form" and then try to Build Solution, it complains not about the misspelled word, but about the FreeTextBox. And then if I correct the misspelled wird, it still complains about the FreeTextBox. Which leads me to believe that Building the Solution does not check absolutely 100% everything that needs to be checked. Is there a more thorough way of compiling a program that I need to use?

HttpHandler works with Visual Studio Development Server debugging, but not otherwise


Hi all,

I'm new to HttpHandlers.  I am writing an HttpHandler that reads uploaded files directly from the request stream to provide progress that can be queried using an AJAX request.  For large files, this seems to be faster than having ASP.NET load the file contents into Request.Files and then streaming the file from there to wherever it goes (Linq to SQL into a VARBINARY column in an SQL Server database.)

My HttpHandler works perfectly when I'm debugging using the Visual Studio Development Server, but doesn't work otherwise.  The application pool for this application in IIS 7 is set to run in Classic Mode, and the Handler Mappings screen in IIS says that I must manage managed handlers in system.web/httpHandlers. 

I set up in my applications Web.config file.

<add verb="GET,POST" path="*.upload" type="Namespace.For.UploadHandler, AssemblyForUploadHandler"/>

It works great, so long as I don't debug with the "Use Local IIS Web server" option.

What else do I need to do to get this to work?


Excel Interop Save as



I want to Save excel workbook using Excel interop in 97-2003 format. Currently I have Office 2007 installed on my machine.

below is the code I am using.

_book.SaveAs("New.xls", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, false, false, Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

The solution is little urgent.


Basic Instincts: Stay Error Free With Error Corrections


Error corrections are an essential part of the Visual Basic coding experience. This article explores the many error correction features offered by Visual Basic and provides a glimpse at the future release of Visual Studio 2010.

Dustin Campbell

MSDN Magazine July 2009

.NET Interop: Automate Acceptance Testing With IronRuby


Acceptance testing verifies that the system under development meets the customer's requirements. Learn the benefits here.

Ben Hall

MSDN Magazine March 2009

.NET Interop: Getting Started With IronRuby And RSpec, Part 1


See how IronRuby lets you employ the straightforward Ruby language to create acceptance tests that interoperate with .NET-compliant code.

Ben Hall

MSDN Magazine February 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend