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