.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

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :Windows Application
Ok actually i m new to .net so you can tell me that i m right or wrong.   1. First of all i created a class library project in which i added a Windows Form (ModuleTest.cs) in this form i added a web browser control.This form is having on method. public void CheckModule(String username, String password, String modulename, List<CustumFields> objList)         {                  ----------------                  -----------------           }   then i build this whole library.(ClassLibrary.dll). 2. I created a web site in which i added ClassLibrary.dll reference.     then i placed on button control over the page protected void Button1_Click(object sender, EventArgs e)         {             ModuleTest obj = new ModuleTest();             List<CustumFields> objlist= new List<CustumFields>();             obj.CheckModule("admin", "adm1n1@3", "Testing102", objlist);     

View Complete Post

More Related Resource Links

ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current

I have created a class library in which i m having Web Forms.now when i use this dll in ASP.NET websiteand call methods            ModuleTest obj = new ModuleTest();            List<CustumFields> objlist= new List<CustumFields>();            obj.CheckModule("admin", "password", "Testing102", objlist);then it gives errorActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartmentthis.components = new System.ComponentModel.Container();            this.panel1 = new System.Windows.Forms.Panel();            this.webBrowser1 = new System.Windows.Forms.WebBrowser();            this.timer1 = new System.Windows.Forms.Timer(this.components);            this.SuspendLayout();this error occurs at this.webBrowser1 = new System.Windows.Forms.WebBrowser();when i mouse over webBrowser1 then it shows null....Whats the problem?

Knowing the event occured in user control in current page




      My web application has user control which uses third party controls called Devexpress controls. The user control is a menu  and is part of the Master page. It is placed there because this needs to be available in all the pages. My user controls raises a even on item clicked. Now, My question is that Is there any way to know that the event has occurred in page_load of the current page in which I am in?

Login control - Controls do not exist in current context

Hi all,Trying to set up the Login control as a User control, but none of the controls exist in the current context?None of my code below is recognised? What's going on here please? I've rebuilt the solution many times.if (Membership.ValidateUser(this.UserName.Text, this.Password.Text))        {            FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked);        }        else        {             Msg.Text = "Login failed. Please check your user name and password and try again.";        }

Using ActiveX control in WPF

I'm attempting to host an ActiveX control in a WPF app. After attempting to use existing info on the web and here, I've hit a dead-end. I need to use an ActiveX control provided to communicate with a UV power meter . They provide an application that registers and uses the control and even includes some useful demo apps. I stripped out the OCX file and put it here if needed. You won't have the power meter to talk to, but the app and demos will still load the ActiveX control successfully. I created a simple Windows Forms application. I was able to bring the ActiveX control into the toolbar, drop it into my form, and everything is fine. The demo apps they provide do this as well. However, getting this to work in a WPF environment is another story. The control can't be added to the toolbox and "dragged" into the app. So far I've tried two techniques: Technique found here . I am able to add a reference to the control, but then I enter namespace ____. The xmlns:ax namespace it suggests making cannot find the information. Here's my attempt based on what the object viewer tells me: xmlns:ax="clr-namespace:OphirUsbXLib;assembly=Interop.OphirUsbXLib" Technique found here . This is essentially to create a new project that creates a library based on Windows Forms, which contains the ActiveX control (yikes). I am able to add the Windows Forms Host, but I canno

Activex control to Print a Zebra Tag

Hi All, I'm trying to create an Activex control (similar to the Crystal Activex) to Print tag's from a Client side to a Com Port 1. I created a User control I can pass values to it etc, but It won't Print. Any Ideas? User Control Code:Imports System.Text Namespace Tag Public Interface AxMyControl Property UserText() As String End Interface 'AxMyControl Public Class myControl Inherits System.Windows.Forms.UserControl Implements AxMyControl Private mStr_UserText As String Public Property UserText() As String Implements AxMyControl.UserText Get Return mStr_UserText End Get Set(ByVal Value As String) mStr_UserText = Value TextBox1.Text = mStr_UserText Print() End Set End Property Public Function Print() As Boolean Dim tstr As New StringBuilder ' Printer Code tstr.Insert(0, "^XA") tstr.AppendLine("") tstr.Append("^LH5,30") tstr.AppendLine("") tstr.AppendLine("") tstr.Append("^FO75,110^BY1.5") tstr.AppendLine("") tstr.Append("^B3N,N,75,Y,N") t

Repeater Control Does not exist in current context, but other controls do


I have an aspx page containing a number of asp:Repeater Controls.

Im not using the default code-behind file that is generated, ive changed this to file in a different folder.

In the code-behind, i populate the repeater controls, all was workign fine until i added another repeater control to the aspx page.
In the code-behind, the intellisense picks up this control and i can access its methods and properties to set the datasource and bind the data. However, when i go to build the project, i get an error "The name Repeater1 does not exist in the current context"

Firstly, all the other repeater controls, declared in exactly the same way, do not throw throw this error.
Secondly, yes the repeater does have a runat="server" tag.
Thirdly, It is not inside any other controls.

I have tried various different methods of accessing this repater instead of just "Repeater1." but each returns null:

Repeater r1 = (Repeater)Page.FindControl("Repeater1") ;
Repeater r1 = (Repeater)Page.Master.FindControl("Repeater1"); 
Repeater r1 = (Repeater)Master.FindControl("Repeater1") ;

Ive no idea why this "doesnt exist in the current context" as all the other controls on this page do, even if i create a literal i get the same problem

Cannot call an ActiveX control from within a .NET WebBrowser control


I have a simple webpage that starts an ActiveX control. Here's the code:

<script language="JavaScript" type="text/javascript">
   try {
      document.write("<object classid='clsid:1D980DC8-9C45-11D3-9C5C-00A13234F0A2' id='myActiveX' name=' myActiveX'  width='0' height='0'></object>");
      var bReturn = myActiveX.StartControl();
   catch (e) {
      document.write('Failed<br>' + e.name + '<br>' + e.message);

This works well when I call this page directly from Internet Explorer on Windows XP, 7 & server 2003

I created a .NET form in Visual Studio, and added a .NET WebBrowser Control from the toolbox. I set the URL of the WebBrowser to call the same web page.

I complied it & ran the executable. This works well from Windows XP & server 2003, but fails in Windows 7. Here's the JavaScript error message:


JQuery & dynamically instantiated User control



I have one problem which needs to be resolved immediately. I am using JQuery Datatable (http://www.datatables.net/).

This JQuery datatable is present in one of my webuser control named "LeftVerticalLayOut.ascx". I am dynamically instantiating Webusercontrol on click of a link button. This link button is bound with the trigger event of Update Panel control.

So clarifying once again : I have one UpdatePanel which I am triggering with Link button("lnkLoadControl") . On click on "lnkLoadControl" I am able to load Usercontrol("LeftVerticalLayOut.ascx") onto the updatepanel. Now the jquery datatable I am creating in load event of Usercontrol is getting generated.


After the datatable(having id as "example") is created, I am calling the below code in my

function loadHandler()

function BeginRequestHandler(sender, args)

function EndRequestHandler(sender, args)

ActiveX control replacement by silverlight technology



We developed an ActiveX plug-in for PowerPoint on Windows  The control allows content to be created in some graphical application, transferred to a PowerPoint presentation, and manipulated in 3D in PowerPoint in a view-only manner.  Graphical application is a scientific application which provides ability to create atoms, molecules, defining their bonding and defining surfaces, so user basically create molecules, proteins into the application and transfer it into ActiveX control using  copy-paste.

We want to shift this technology from ActiveX to other, so that it can be used by any software like Microsoft Word, SharePoint, Web browser, and Microsoft Excel.


Can someone tell me alternative of ActiveX? What other technologies can be used to develop same functionality in Microsoft domain? Any pointers indicating for Advantage and disadvantage of using ActiveX and other proposed technology?

I heard about Silverlight, but I do not know anything how it would be useful and how it is beneficial over ActiveX?

How to get Metadata of a ActiveX control on fly in C#?


I am facing problem in getting metadata(like properties,Events and methods) of a ActiveX controls on fly from a web page(using <OBJECT> tag and ActiveXObject or CreateObject), just by giving its ClassID or ProgramID using C# or C++.

Is there any standard way to get meta data of a activex control present in a web page using C# and C++?

Actually i am working for a product based company. The product on which i am working has a feature of Web automation, Currently our product has no capability of automating Activex controls present in a web page. We are enhacing our product to have this support.

i am doing research on this and stucked up at this point of getting meta data of a ActiveX control. I need meta data to know its list of attributes,methods and events, which will help in automating the activex control.

Help me in solving this issue, provide me if any sample code or examples avaialble Or  provide me links to refere.













SharePoint DateTime control returning current date when no date is selected

In WSS 3.0, I am using sharePoint DateTime control. I retrieve the date selected by the user using SelectedDate property of the sharePoint DateTime control.

The issue is that even when the user has not selected any date in the sharePoint DateTime control, the SelectedDate property of the sharePoint DateTime control returns current date. I guess it should return DateTime.MinValue or null when the user has not selected any date in the sharePoint DateTime control.

Kindly clarify.


Accessing window control library .dll from .aspx page (ActiveX)


I have a control in a 'window control library' which handles - 'drag and drop' files from computer to a listbox control, I then reference this .dll in .aspx (See code below). Now, when i try to access this through webserver for drag and drop files i get following errror - The type of the first permission  that failed was : System.Security.Permission.FileIOPermission.

How do I handle this, so that drag and drop of files can happen over the webpage residing at webserver.


namespace testWinControl1
    public partial class UserControl1 : UserControl
        private string appTitle = "DragnDrop Files";
        public UserControl1()
        private void button1_Click(object sender, EventArgs e)

Problem hosting .NET build ActiveX Control in existing VB6 ActiveX control


Hi all,

After struggling several days with this it's time to find some help.

I'm developing for a third party application that supports a modular design by hosting custom ActiveX Controls in an ActiveX Control Container (basically a Tab control with each hosted control on its own tab).
An ActiveX Control build with VB6 with no added code shows up just fine, but I don't want to use VB6, I want to use a .NET UserControl which exposes itself as an ActiveX Control. I successfully created a class library project with a Windows Forms User Control, which is exposed to COM as a control. With some extra registry entries, the control even shows up in the VB6 designer. If I create a small VB6 test application with my .NET control on the form, it shows up just fine.

The problem is that nothing is painted on the tab control, if I add my control to the third party software. The UserControl constructor is called (twice), but that's it. When I switch tabs, the information from the previous tab stays visible, so no Draw() operations are executed at all.

I have read some articles that anything else but Internet Explorer is not supported for hosting ActiveX controls build in .NET but I'm not sure if this is still true.

I hope there is a solution to get this to work in .NET, otherwise I would have to switch to C++ (which

How to access the data item(current row) in the field template control?



     How to access the data item(current row) in the field template control? 

ActiveX Control


Hi ,

 Can any one tell me how to make an  ActiveX control that is installed on the windows and when i double click on any work in the browers (IE,FireFox) then a popup open and Display this word in that popup.  

Please help.


User Control instantiated programmatically


When I use a user control (UC) and instantiate it in XAML, everything works as expected, including a button_click event.  However, when the UC is instantiated in code, the button_click event complains that the UC does not exist in current context. 

What am i missing?


Convert VB6 ActiveX Control to VB.NET And Incorporate it Into ASP.NET

I have an existing ASP.NET application that is written mainly in VB.NET.  Currently one of the ASPX form has an ActiveX control on it.  The ActiveX control is a Windows.Form written in VB6.  Inside that ActiveX control, it has an old third party ActiveX control (Tidestone Formula One) embedded in it.  In other words, we have a Windows-Form VB6 ActiveX wraps around another ActiveX control.

I would like to convert that ActiveX control from VB6 to VB.NET in order to bring everything to the same .NET platform and also to simplify debugging.

I have already converted the VB6 ActiveX control to VB.NET using Upgrade Wizard in Visual Studio 2003.  The problem is that Visual Studio 2003 cannot create Windows.Form ActiveX wrapper.  It can only convert the VB6 ActiveX into a DLL class library (not a control).  I cannot use the converted DLL into the ASPX web form because the DLL is not a control.

I know one of the solution is to replace the old third party ActiveX with .NET version and rewrite the VB6 ActiveX wrapper.  But I am not ready to do this just yet because I am just newly assigned to maintain that application and I need to understand what all my options are.

According to chapter 10 in the Microsoft document "Upgrading Visual Basic 6.0 Applications to Visual Bas

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