473,372 Members | 930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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.Page

#Region " Web Form Designer Generated Code "

#End Region

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

Dim obj As New MediaPlayer.MediaPlayerClass()

obj.Stop()

End Sub

End Class

Nov 19 '05 #1
3 2489
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 MediaPlayerClass
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.Page

#Region " Web Form Designer Generated Code "

#End Region

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

Dim obj As New MediaPlayer.MediaPlayerClass()

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(Borland 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_il2launcherClass

Public Class host
Inherits System.Web.UI.Page
Protected WithEvents bCancel As System.Web.UI.WebControls.Button
Protected WithEvents lblTitle As System.Web.UI.WebControls.Label
Dim obj As ogl_x.ogl_il2launcherClass

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

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

#End Region

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

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

Private Sub bCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bCancel.Click
Response.Redirect("lobby.aspx", False)
End Sub

End Class
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message news:4i********************************@4ax.com...
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 MediaPlayerClass
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.Page

#Region " Web Form Designer Generated Code "

#End Region

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

Dim obj As New MediaPlayer.MediaPlayerClass()

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
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...
1
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....
5
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 :...
1
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...
3
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...
1
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...
23
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...
6
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
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.