473,722 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ACTIVEX, WEB FORMS, AND INTEROP ISSUE


Anyone know where the documentation is regarding Activex controls in asp web forms?

I'm using VS.NET 2002 enterprise and am trying to use Activex controls in vb.net web form app.

I do the add control to pallete and then add a reference. I get the interop dll added to bin folder.

I did this with the MediaPlayer activex control as a simple case to to try and get it working.

I set the control to autostart via the html parameter tag for the control.

Then I set it to stop in the page_load but it doesn't

What's the trick in getting apsx code to talk to the activex control?

I put the following code in the aspx file:

*************** *************** *************** *************** *************** *************** *************** *************** *************** ***********
Imports MediaPlayer

Public Class host

Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load

Dim obj As New MediaPlayer.Med iaPlayerClass()

obj.Stop()

End Sub

End Class

Nov 19 '05 #1
3 2517
Hi Jeffery:

You'll want your interactions with media player to take place in the
client's browser, meaning you'll need client side script (JavaScript
etc).

Chances are you'll be doing everything client side and won't need a
reference or interop dll on the server. Dimming a new MediaPlayerClas s
in Page_Load will create the player on the server, which I'm sure you
don't want. Know what I mean?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 30 Apr 2005 22:56:02 -0400, "Jeffery Franzen"
<je************ *@comcast.net> wrote:

Anyone know where the documentation is regarding Activex controls in asp web forms?

I'm using VS.NET 2002 enterprise and am trying to use Activex controls in vb.net web form app.

I do the add control to pallete and then add a reference. I get the interop dll added to bin folder.

I did this with the MediaPlayer activex control as a simple case to to try and get it working.

I set the control to autostart via the html parameter tag for the control.

Then I set it to stop in the page_load but it doesn't

What's the trick in getting apsx code to talk to the activex control?

I put the following code in the aspx file:

************** *************** *************** *************** *************** *************** *************** *************** *************** ************
Imports MediaPlayer

Public Class host

Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load

Dim obj As New MediaPlayer.Med iaPlayerClass()

obj.Stop()

End Sub

End Class


Nov 19 '05 #2
Hi Scott,

You are right. I used a bad example for what I was really trying to do with an activex control I built. I was trying to figure out if it is my control or just the way I use it in the vb.net asp code behind module. I am trying to load values into the control from the server side when the page is requested by the client. The reason I am using activex is that this control is part of a game lobby server and activex is the only way I know of to start the game on the client side. The control works fine in the web form except for the data exchange between the asp code and the control. I've read everything I could find on using COM objects in vb.net (or cs.net) web forms. Everything builds and runs fine. It's just that the web form code doesn't seem to be talking to the same instance of the activex control that is embedded in the asp page. I can set properties of the control and read them back via asp, but the control doesnt visually update any of them and if I change values in the displayed control they dont get reflected back to the asp code. If you or anyone else knows of an example of a working activex control in vb or cs.net code please let me know.

Thank you,
Jeff

Here are the steps I take to use the control:
1 - Build and register component(Borla nd CPP 6.0)
2 - Add the component to the Toolbox/Components in VS.NET
3 - Drag and drop the component from the toolbox to the asp design page
4 - Add a reference (COM) to the activex component library
5 - add the following code to the aspx code behind (bold print)

Imports ogl_x.ogl_il2la uncherClass

Public Class host
Inherits System.Web.UI.P age
Protected WithEvents bCancel As System.Web.UI.W ebControls.Butt on
Protected WithEvents lblTitle As System.Web.UI.W ebControls.Labe l
Dim obj As ogl_x.ogl_il2la uncherClass

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim str As String
Dim obj As New ogl_x.ogl_il2la uncherClass()
obj.ServerName = "My Server"

'Put user code to initialize the page here
'lblTitle.Text = str
Select Case Session("GameTy pe")
Case "il2", "il2fb", "pfsa", "pfm"
Case Else
End Select
End Sub

Private Sub bCancel_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles bCancel.Click
Response.Redire ct("lobby.aspx" , False)
End Sub

End Class
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message news:4i******** *************** *********@4ax.c om...
Hi Jeffery:

You'll want your interactions with media player to take place in the
client's browser, meaning you'll need client side script (JavaScript
etc).

Chances are you'll be doing everything client side and won't need a
reference or interop dll on the server. Dimming a new MediaPlayerClas s
in Page_Load will create the player on the server, which I'm sure you
don't want. Know what I mean?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 30 Apr 2005 22:56:02 -0400, "Jeffery Franzen"
<je************ *@comcast.net> wrote:

Anyone know where the documentation is regarding Activex controls in asp web forms?

I'm using VS.NET 2002 enterprise and am trying to use Activex controls in vb.net web form app.

I do the add control to pallete and then add a reference. I get the interop dll added to bin folder.

I did this with the MediaPlayer activex control as a simple case to to try and get it working.

I set the control to autostart via the html parameter tag for the control.

Then I set it to stop in the page_load but it doesn't

What's the trick in getting apsx code to talk to the activex control?

I put the following code in the aspx file:

************** *************** *************** *************** *************** *************** *************** *************** *************** ************
Imports MediaPlayer

Public Class host

Inherits System.Web.UI.P age

#Region " Web Form Designer Generated Code "

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load

Dim obj As New MediaPlayer.Med iaPlayerClass()

obj.Stop()

End Sub

End Class

Nov 19 '05 #3
Hi Jeffrey:

<snip>
The control works fine in the web form except for the data exchange between the asp code and the control. I've read everything I could find on using COM objects in vb.net (or cs.net) web forms. Everything builds and runs fine. It's just that the web form code doesn't seem to be talking to the same instance of the activex control that is embedded in the asp page.
Yes - because they are two seperate instances of the control. One you
instantiated in the clients browser, and a second one you are
instantiating on the server.

You'll need to set those properties on the client side with JavaScript
or VBScript for the appearance to change - anything that happens on
the server in Page_Load to an activeX control instantiated server side
won't be visible on the client's browser.
I can set properties of the control and read them back via asp, but the control doesnt visually update any of them and if I change values in the
displayed control they dont get reflected back to the asp code. If you or anyone else knows of an example of a working activex control in vb or cs.net code please let me know.


This article:

HOW TO: Host ActiveX Controls in a Web Form
http://support.microsoft.com/default...b;EN-US;317392

is a very simple example but notice how it changes the width of the
ActiveX chart control on the client - with a JavaScript function. If
you can find any examples for your control that use JavaScript you'll
be in business. The server side tech won't matter much at all - ASP,
ASP.NET, PHP, etc, because all the interaction will be in client side
script.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9732
by: Sunny | last post by:
Hi all, My dev platform: VS .net 2003, win2000pro, office 2000, MOD 2000, C#. Bellow you may read my posting in other group. According that issue, I have dig around and I'm wondering ... My code for creating the ActiveX control in C# is: public class IceOptions : System.Windows.Forms.UserControl,
1
8645
by: Craig | last post by:
I am having problems getting an ActiveX DLL written in VB6 to call a method in a C# class library component. My C# DLL is called CSharpProject.dll and contains a public class called CSharpClass. In this class is a single public method that returns the string "Hello from C sharp". My VB6 ActiveX DLL references the C# DLL (CSharpProject.dll) using the
5
8778
by: andy.g.ward | last post by:
I keep getting this when trying to create an MFC activex control in a c# windows service - anyone got any ideas what the missing module could be??? Exception thrown : System.IO.FileNotFoundException: The specified module could not be found. at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid) at System.Windows.Forms.AxHost.CreateWithoutLicense() at...
1
3108
by: Mehr H | last post by:
I have been working on this for several days and am still have had no success in achieving this. Pleae help. It seems that documentation for this is very limited. I have looked in several books and they all seem to say either nothing about this or that this is "out of the scope of this book", even "Professional ASP.NET". I have a ActiveX component that I'd like to expose through a .NET wrapper so in the case that a client browses to my...
3
6862
by: Evan Delodder | last post by:
I am trying to edit form elements (labels, text box's, etc) in Visual Studio.NET using VB.NET. Whenever I edit certain forms’ appearance whether it is through the code, or through the designer, I receive this (Invalid ActiveX State Exception) error message at runtime whenever the form is called. I am simply trying to change the size and location of some form elements whose location and size were thrown off during the upgrade from VB6.0 to...
1
3355
by: BisSoft | last post by:
Hi I tried to import SchokWaveFlash COM object onto my form. I succesifuly find it in Reference browser within COM objects and add it to the toolbox, but when I drag the control on the form it gives me the following message: "Failed to import ActiveX Control. Please ensure that it is properly registered" I know for a fact that this object can regularily be imported, because I have downloaded an example from codeproject where a guy...
23
3475
by: Galen Somerville | last post by:
A VB6 ActiveX.exe raises an event which is seen by the VB6 App. Same setup in VB2005. The event to be raised is in form frmSweep. As in VB6, frmSweep is hidden when the events take place. I know by actions on the screen and sounds in the speakers that VB2005 is using the ActiveX.exe correctly. However the events are never raised !!!
6
3519
by: Budhi Saputra Prasetya | last post by:
Hi All, I'm trying to display .NET Custom Control (created using Inherited Control) on an ASPX page, but no luck. I already registered the Control to Global Assembly Cache through .NET Framework 1.1 Configuration. I have also put a reference to the control on my ASP .NET project. The view that I get is only a disabled text area. Below is the code that I'm using:
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8051
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.