InitializeComponent() Error Help - vb.net

Im a beginner programmer for Visual Studio 2005 and coding in VB and i required some help.
I've been hitting this error everytime i call InitializeComponent() :
ComException was unhandled
Class not registered (Exception from HRESULT : 0x80040154 (REGDB_E_CLASSNOTREG))
What does it mean ?? and how do I go by it ??
Thank You.

It looks like the exception is occurring due to a component you are using in the application not being registered on the machine you are running it on.
I assume you are using an unmanaged COM library of some kind, possibly a control on your form?
If this is the case and you know which component it is you can use Regsvr32 to register it.
(Regsvr32 is the command-line tool that registers .dll files as
command components in the registry)
To do so, open a command prompt window, navigate to the dll in question and run the following command regsvr32.exe filename.dll
If the above is not the case then please could you post the full exception / stacktrace to be analysed.

Related

The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception

Just clicked on new Razor v3 Website in visual studio 2017 v15.4.3 and tried to run it. It's kicking out the following error: The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'MySql.ConnectorInstaller. Ive search web.config and every other file in the site and I dont have any references to MySql nor did I add any refs to it. I do have MySql installed on my dev machine, though.
In Package Manager reinstall WebMatrix.WebData
update-package WebMatrix.WebData -reinstall
Restart VS

Retrieving the COM class factory for component with CLSID Error

I get this error
Retrieving the COM class factory for component with CLSID {819F123A-B24A-4EB8-BED1-B5DFC5CB5194} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
For below code:
Public WithEvents vp2 As VSPrinter8Lib.VSPrinter
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
vp2 = New ``VSPrinter8Lib.VSPrinter
End Sub
End Class
I exhausted with all option like running it on 32 bit mode in VS, copying in syswow64 folder, converting dll to 32 bit but no luck. I am not getting 32 bit version of "VSPrinter8Lib" on the internet, neighter i am able to convert/register it to 32 bit using regsvr32 (Getting error Entry point was not found) nor able to find CLSID in registery (since it doen't come with installer). Kind of strucked since last 1 week. Seeking for help. Thank you in advance.
I am able to resolve issue. When using an ActiveX control is a .NET project, Visual Studio will create a "bubble" of ActiveX to allow the control to operate and then create an interop layer to allow your .NET project to communicate with the activex control. In my example, i was attempting to register the interop layer Visual Studio created (Interop.VSPrinter8Lib.dll) and not the actual ActiveX controls itself. Thus you need to get ActiveX OCX file for desired Introp DLL e.g. vsprint8.ocx on place of Interop.VSPrinter8Lib.dll and Please ensure all those files are in the directory where your registering the OCX files (it should be in C:\Windows\SysWow64 if on a 64-bit machine). In addition, please ensure the command line (cmd.exe) is run as an admin.
e.g. I kept OCX file in C:\Vineet\vsprint8.ocx and would run below command
c:\windows\syswow64\regsvr32.exe C:\Vineet\vsprint8.ocx

"Type 'System.Data.SqlClient.SqlConnection' is not defined." in .Net Web Site

I'm trying to get a .NET web site running on a network server, and while everything is set up and running locally on my machine (using IISExpress), when I deploy to a Windows Server 2008 server with IIS installed, I end up getting compilation errors when trying to use an SqlConnection:
Compiler Error Message: BC30002: Type 'System.Data.SqlClient.SqlConnection' is not defined.
Now, I have both import statements at the beginning of the source file as follows:
Imports System.Data.SqlClient
Imports System.Data
In the compilation warnings it lists a very strange error:
Warning: BC40056: Namespace or type specified in the Imports 'System.Data.SqlClient' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
Evidently, the compiler can't find System.Data.SqlClient. The IIS application pool is running .NET 2.0, and my site is targeting 3.5. I'm very new to .NET development, and I'm learning this as I go, but this has me stuck. Am I missing a dependency? Do I need SQL Server Management Studio installed on the server?
A couple of things
Inside your web application you might be missing the reference to System.Data
Right click on Solution Explorer
Add References
Click on .NET and find System.Data.dll
You may already have a class called SqlConnection (Your own), and there might be an ambiguity. Reference the Sqlclient/SqlConnection class directly System.Data.SqlClient.SqlConnection
I had this problem.
It's easy to solve it.
REPALCE
using Microsoft.Data.SqlClient;
instead of
using System.Data.SqlClient;

log parser error

I have never used log parser before..
well I am getting this error now.. i don't know the reason..
Retrieving the COM class factory for component with CLSID {8CFEBA94-3FC2-45CA-B9A5-9EDACF704F66} failed due to the following error: 80040154.
can ya help me out with this..
:)
The error code means the class in not registered. Running the following command will probably solve the problem:
regsvr32 <path>\LogParser.dll
If you move the DLL around (install it with your app, for instance), you'll have to repeat the call each time. Or, if you'd like to install it from your app, you can call the exported DLLRegisterServer, which is what regsvr32 calls.
Other answer:
Download and install Log Parser 2.2

When a DLL is not found while P/Invoking, how can I get a message about the specific unmanaged DLL that is missing?

When you link to an unmanaged library (say 'A.dll') which in turn links to another library ('B.dll'), and B.dll is missing, you will get a run-time error message about failing to load 'B.dll'.
But when you P/Invoke into 'A.dll' from managed code, you'll get a general exception of this form:
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'A.dll': The specified module could not be found.
How can I get an error message that pinpoints the specific unmanaged dll file that failed to load, when p/invoking from managed code ?
I don't think there's any specific API you can use to pinpoint why LoadLibrary (the underlying Win32 API) failed for 'A.dll'. I recommend the use of a tool like Dependency Walker to troubleshoot DLL loading errors.
I'm not sure how you can get this in the form of an exception. When I run into this problem I usually try and open the DLL with depends.exe. It's pretty good and reporting missing dependencies that exist if the DLL is simply loaded from it's current location.
You won't be able to get an answer from the exception, but you can do it (with a lot of work) through Process Monitor. This article discusses how and also includes a tool to scan Process Monitor logs to find the specific problem.
http://tech.blinemedical.com/debug-could-not-load-file-or-assembly-or-one-of-its-dependencies/
The Fusion Log Viewer is a good tool to debug assembly loading problems in .NET apps.
For identifying general file-load problems, you can use Process Monitor.