Oenone,
> Thanks for your response -- that works fine, but it isn't what I'm after.
> :-) Perhaps I should explain a bit more.
I believe I mostly knew what you are after, unfortunately this is what you
get. :-(
> I have a large volume of VB6 DLLs which I want to be able to call this
class
> thinking that it's the original ASP (not ASP.net) Form object. They
> currently all late-bind to the real ASP Form object so providing I can
make
> the interface act the same they should all carry on working fine
(otherwise
> I have a couple of hundred DLLs that will all need to be rewritten before
> than can work with my VB.net/ASP.net application, which isn't an option I
> have available to me).
Are you writing a VB.NET component or a VB6 component? Is it going to be
used in VB.NET, VB6, or VBScript?
> Or am I just approaching this wrong?
Your approaching it wrong as Default properties are not supported. Also
VB.NET 2003 has no real support on what you are attempting if VB.NET is the
target (other then adding a "ToWhatever" method).
If you are attempting to write a VB.NET component that exposes a COM default
property to VB6, I would recommend asking "down the hall" in the
microsoft.public.dotnet.framework.interop newsgroup. As what you want really
deals with assigning dispatch Ids & Interop. I believe you can use the
System.Runtime.InteropServices.DispIdAttribute to do what you want, however
I have not actually tried it.
http://msdn.microsoft.com/library/de...classtopic.asp
If you are writing a VB.NET component for use in VB.NET then:
> The only other thing I can think of
> doing is writing a COM DLL wrapper in VB6 itself (in which I know exactly
> how to do this) which builds up the IIS.Form return value when the default
> property (Item) is called with no parameters. However I'd really like to
> avoid having this second layer of wrappers if I can help it.
The default property in VB6 will not be honored in VB.NET only index
properties can be Default in .NET.
The closest VB.NET to VB.NET you may get is an implicit conversion operator,
which is not available in VB.NET 2003. It will be available in VB.NET 2005
(Whidbey) due out sometime in 2005.
Public Class Complex
Private ReadOnly m_real As Double
Private ReadOnly m_imag As Double
Public Sub New(ByVal real As Double)
MyClass.New(real, 0)
End Sub
Public Sub New(ByVal real As Double, ByVal imag As Double)
m_real = real
m_imag = imag
End Sub
' Define conversion from Double to Complex
Public Shared Widening Operator CType(ByVal real As Double) As Complex
Return New Complex(real)
End Operator
' Define conversion from Complex to Double
Public Shared Narrowing Operator CType(ByVal c As Complex) As Double
If c.imag <> 0 Then Throw New InvalidCastException
Return c.m_real
End Operator
End Class
However be careful with have a narrowing operator from your class to a base
type, as you may loose data (narrowing).
Public Shared Narrowing Operator CType(ByVal iis As IIS) As String
However the conversion operator smells like bad code for what you are
asking...
Hope this helps
Jay
"Oenone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Jay,
>
>
> > Try:
> >
> > ? IIS.Form.ToString
>
> Thanks for your response -- that works fine, but it isn't what I'm after.
> :-) Perhaps I should explain a bit more.
>
> I have a large volume of VB6 DLLs which I want to be able to call this
class
> thinking that it's the original ASP (not ASP.net) Form object. They
> currently all late-bind to the real ASP Form object so providing I can
make
> the interface act the same they should all carry on working fine
(otherwise
> I have a couple of hundred DLLs that will all need to be rewritten before
> than can work with my VB.net/ASP.net application, which isn't an option I
> have available to me).
>
> There are three ways they can access the ASP Form object:
>
> IIS.Form
> returns a complete breakdown of the Form content, e.g.:
> Field1=Value1&Field2=Value2&Field3=Value3
>
> IIS.Form("Field1")
> returns the value of the named Form field, e.g.:
> Value1
>
> IIS.Form.Count
> (or other properties/methods), calls the appropriate member code,
> e.g.:
> 3
>
> I have the second and third items working but not the first.
>
> I tried defining the Item property so that its parameter (ItemId) was
> optional, thinking that might do the trick. But VB told me that
"properties
> with no required parameters cannot be declared 'Default'", which put an
end
> to that idea.
>
> Or am I just approaching this wrong? The only other thing I can think of
> doing is writing a COM DLL wrapper in VB6 itself (in which I know exactly
> how to do this) which builds up the IIS.Form return value when the default
> property (Item) is called with no parameters. However I'd really like to
> avoid having this second layer of wrappers if I can help it.
>
> My thanks in advance,
>
> --
>
> (O)enone
>
>