Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Use of a VB.NET enum in a window.external method call Options

Reply
Thread Tools

Use of a VB.NET enum in a window.external method call Options

 
 
Peter
Guest
Posts: n/a
 
      07-05-2009
Hi

Does anyone know if it's possible to for Javascript to reference an
enum in a Class that is assigned to a VB.NET Form's embedded browser
control using the ObjectForScripting property?

I define a Class as follows:

<System.Runtime.InteropServices.ComVisibleAttribut e(True)> _
Public Class MyClass


Public Enum MyEnum
Enum1 = 1
Enum2 = 2
Enum3 = 3


End Enum


Public Sub MyMethod(Param1 as MyEnum)
<Code goes here>


End Sub


End Class


"MyClass" is then assigned to the browser control as follows:


Dim lMyClass as MyClass
Browser.ObjectForScripting = lMyClass


From my web page which runs inside Browser I want to make the
following call to the MyClass.MyMethod as follows:


function button_click()
{
window.external.MyMethod(MyEnum.Enum2)
}


However it seems the "MyEnum" is not recognised across the COM
interface between the browser and .NET. The "window.external.MyMethod
(MyEnum.Enum2) Javascript statement results in an "Object does not
support Automation" error message (or similar). If I change the
declaration to MyMethod to "MyMethod(Param1 as Integer)" and then use
the following Javascript statement it works fine:
"window.external.MyMethod(2)"


Can someone tell me if it's possible for Javascript to reference an
enum in a Class that is assigned to a VB.NET Form's embedded browser
control using the ObjectForScripting property?


Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ENUM server for private ENUM kael UK VOIP 2 02-25-2007 11:54 AM
enum: display elements of an enum specified at runtime Jerminia Java 3 10-07-2005 10:08 PM
enum within an enum - Java 6 06-13-2005 12:51 AM
Including an enum within another enum, possible? mrhicks C Programming 2 06-10-2004 03:00 AM
How to enum an enum? Ernst Murnleitner C++ 5 11-13-2003 11:06 AM



Advertisments