473,387 Members | 1,722 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,387 software developers and data experts.

VB dll files

Can I still write dll files in Visual basic.net?
Jul 21 '05 #1
12 1644
You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL
using COM Interop. These DLLs could be used by .NET apps or VB (more
specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET that will
be used by a VB 6 front-end you will need to deploy the .NET Framework to
the machines that will use the DLL.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Can I still write dll files in Visual basic.net?

Jul 21 '05 #2
What I want to do....
is write a .net dll to call vb6 dll's so that i have it wrapped so to speak.
Daryl

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL
using COM Interop. These DLLs could be used by .NET apps or VB (more
specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET that will be used by a VB 6 front-end you will need to deploy the .NET Framework to
the machines that will use the DLL.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Can I still write dll files in Visual basic.net?


Jul 21 '05 #3
Hi Daryl,

..NET handles that for you! If you're using Visual Studio just go to the "Add
Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
Visual Studio will create a .NET DLL wrapper for you automatically.

You you're not using VS then you need to use the tlbimp.exe command line
utility which is part of the .NET Framework SDK. See the link below for more
info on this utility

http://msdn.microsoft.com/library/de...rTlbimpexe.asp

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
What I want to do....
is write a .net dll to call vb6 dll's so that i have it wrapped so to speak. Daryl

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL using COM Interop. These DLLs could be used by .NET apps or VB (more
specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET that

will
be used by a VB 6 front-end you will need to deploy the .NET Framework to the machines that will use the DLL.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Can I still write dll files in Visual basic.net?



Jul 21 '05 #4
This is what I understand. What I don't understand is how I make the
program go to the MTS server (another machine) for all the calls..
I got some advice from AlexFeinman_MVP on the chat about smartdevices today,
but by the time I was able to try it out, I was unable to call any of my
functions. I think it is that I am just unable to understand this area
because it has been thrown on me and I am just learning web services. Can
you help shed some light.
Thank you,
Daryl
<snip from chat>
AlexFeinman_MVP : Q: How do I write a web service that uses a remote MTS
component written in VB6 (using late binding)
AlexFeinman_MVP : A: Use Dim t as Type =
Type.GetFromProgID(componentProgID) to obtain a runtime type and then
Activator.CreateInstance to create an instance of the component. Once you
have an instance, use Type.InvokeMember to call methods.properties by name
AlexFeinman_MVP : .

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
Hi Daryl,

.NET handles that for you! If you're using Visual Studio just go to the "Add Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
Visual Studio will create a .NET DLL wrapper for you automatically.

You you're not using VS then you need to use the tlbimp.exe command line
utility which is part of the .NET Framework SDK. See the link below for more info on this utility

http://msdn.microsoft.com/library/de...rTlbimpexe.asp
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
What I want to do....
is write a .net dll to call vb6 dll's so that i have it wrapped so to

speak.
Daryl

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:em**************@TK2MSFTNGP10.phx.gbl...
You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL using COM Interop. These DLLs could be used by .NET apps or VB (more
specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET
that
will
be used by a VB 6 front-end you will need to deploy the .NET Framework

to the machines that will use the DLL.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
> Can I still write dll files in Visual basic.net?
>
>



Jul 21 '05 #5
Hi Daryl,

Alex is right, you can do it that way but you can also do it using a more VB
6 style. The CreateObject function is still available in VB.NET so you could
use:

Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")
' use object
System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
obj = Nothing

Note this code shows how to use the object late bound and requires Option
Strict Off. You can do this early bound by setting a reference to your
component and using a variable to the correct type, this would of course be
preferred.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
This is what I understand. What I don't understand is how I make the
program go to the MTS server (another machine) for all the calls..
I got some advice from AlexFeinman_MVP on the chat about smartdevices today, but by the time I was able to try it out, I was unable to call any of my
functions. I think it is that I am just unable to understand this area
because it has been thrown on me and I am just learning web services. Can
you help shed some light.
Thank you,
Daryl
<snip from chat>
AlexFeinman_MVP : Q: How do I write a web service that uses a remote MTS component written in VB6 (using late binding)
AlexFeinman_MVP : A: Use Dim t as Type =
Type.GetFromProgID(componentProgID) to obtain a runtime type and then
Activator.CreateInstance to create an instance of the component. Once you
have an instance, use Type.InvokeMember to call methods.properties by name
AlexFeinman_MVP : .

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
Hi Daryl,

.NET handles that for you! If you're using Visual Studio just go to the

"Add
Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
Visual Studio will create a .NET DLL wrapper for you automatically.

You you're not using VS then you need to use the tlbimp.exe command line
utility which is part of the .NET Framework SDK. See the link below for

more
info on this utility

http://msdn.microsoft.com/library/de...rTlbimpexe.asp

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
What I want to do....
is write a .net dll to call vb6 dll's so that i have it wrapped so to

speak.
Daryl

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message news:em**************@TK2MSFTNGP10.phx.gbl...
> You can use VB.NET (or C#) to create the equivalent to a VB 6
ActiveX
DLL
> using COM Interop. These DLLs could be used by .NET apps or VB (more
> specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET that will
> be used by a VB 6 front-end you will need to deploy the .NET

Framework to
> the machines that will use the DLL.
>
> --
> Rob Windsor [MVP-VB]
> G6 Consulting
> Toronto, Canada
>
>
> "Daryl Davis" <th***********@hotmail.com> wrote in message
> news:Oe**************@tk2msftngp13.phx.gbl...
> > Can I still write dll files in Visual basic.net?
> >
> >
>
>



Jul 21 '05 #6
If I early bind a reference locally can I use it like this?
Dim obj As Object dim param1 as MyComp.MyClass.MyType
dim param2 as boolean = false
dim intReturn as integer

param1.int1 = 1
param1.string1 = "trial and error"
param1.int2 = 3
obj = CreateObject("MyComp.MyClass", "MyServer")
' use object intReturn = obj.myfunction(param1,param2) System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
obj = Nothing

Note this code shows how to use the object late bound and requires Option
Strict Off. You can do this early bound by setting a reference to your
component and using a variable to the correct type, this would of course be preferred.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
This is what I understand. What I don't understand is how I make the
program go to the MTS server (another machine) for all the calls..
I got some advice from AlexFeinman_MVP on the chat about smartdevices

today,
but by the time I was able to try it out, I was unable to call any of my
functions. I think it is that I am just unable to understand this area
because it has been thrown on me and I am just learning web services. Can
you help shed some light.
Thank you,
Daryl
<snip from chat>
AlexFeinman_MVP : Q: How do I write a web service that uses a remote

MTS
component written in VB6 (using late binding)
AlexFeinman_MVP : A: Use Dim t as Type =
Type.GetFromProgID(componentProgID) to obtain a runtime type and then
Activator.CreateInstance to create an instance of the component. Once you have an instance, use Type.InvokeMember to call methods.properties by name AlexFeinman_MVP : .

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
Hi Daryl,

.NET handles that for you! If you're using Visual Studio just go to the
"Add
Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
Visual Studio will create a .NET DLL wrapper for you automatically.

You you're not using VS then you need to use the tlbimp.exe command
line utility which is part of the .NET Framework SDK. See the link below for more
info on this utility

http://msdn.microsoft.com/library/de...rTlbimpexe.asp
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
> What I want to do....
> is write a .net dll to call vb6 dll's so that i have it wrapped so to speak.
> Daryl
>
> "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in

message > news:em**************@TK2MSFTNGP10.phx.gbl...
> > You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL
> > using COM Interop. These DLLs could be used by .NET apps or VB (more > > specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET

that
> will
> > be used by a VB 6 front-end you will need to deploy the .NET Framework to
> > the machines that will use the DLL.
> >
> > --
> > Rob Windsor [MVP-VB]
> > G6 Consulting
> > Toronto, Canada
> >
> >
> > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > news:Oe**************@tk2msftngp13.phx.gbl...
> > > Can I still write dll files in Visual basic.net?
> > >
> > >
> >
> >
>
>



Jul 21 '05 #7
I should also state that this is in a web service so that smartdevices can
access the dll. (I hope that doesn't throw this whole thing off...)
Daryl
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hi Daryl,

Alex is right, you can do it that way but you can also do it using a more VB 6 style. The CreateObject function is still available in VB.NET so you could use:

Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")
' use object
System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
obj = Nothing

Note this code shows how to use the object late bound and requires Option
Strict Off. You can do this early bound by setting a reference to your
component and using a variable to the correct type, this would of course be preferred.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
This is what I understand. What I don't understand is how I make the
program go to the MTS server (another machine) for all the calls..
I got some advice from AlexFeinman_MVP on the chat about smartdevices

today,
but by the time I was able to try it out, I was unable to call any of my
functions. I think it is that I am just unable to understand this area
because it has been thrown on me and I am just learning web services. Can
you help shed some light.
Thank you,
Daryl
<snip from chat>
AlexFeinman_MVP : Q: How do I write a web service that uses a remote

MTS
component written in VB6 (using late binding)
AlexFeinman_MVP : A: Use Dim t as Type =
Type.GetFromProgID(componentProgID) to obtain a runtime type and then
Activator.CreateInstance to create an instance of the component. Once you have an instance, use Type.InvokeMember to call methods.properties by name AlexFeinman_MVP : .

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:e5****************@TK2MSFTNGP12.phx.gbl...
Hi Daryl,

.NET handles that for you! If you're using Visual Studio just go to the
"Add
Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
Visual Studio will create a .NET DLL wrapper for you automatically.

You you're not using VS then you need to use the tlbimp.exe command
line utility which is part of the .NET Framework SDK. See the link below for more
info on this utility

http://msdn.microsoft.com/library/de...rTlbimpexe.asp
--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:O$**************@TK2MSFTNGP11.phx.gbl...
> What I want to do....
> is write a .net dll to call vb6 dll's so that i have it wrapped so to speak.
> Daryl
>
> "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in

message > news:em**************@TK2MSFTNGP10.phx.gbl...
> > You can use VB.NET (or C#) to create the equivalent to a VB 6 ActiveX DLL
> > using COM Interop. These DLLs could be used by .NET apps or VB (more > > specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET

that
> will
> > be used by a VB 6 front-end you will need to deploy the .NET Framework to
> > the machines that will use the DLL.
> >
> > --
> > Rob Windsor [MVP-VB]
> > G6 Consulting
> > Toronto, Canada
> >
> >
> > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > news:Oe**************@tk2msftngp13.phx.gbl...
> > > Can I still write dll files in Visual basic.net?
> > >
> > >
> >
> >
>
>



Jul 21 '05 #8
You've kind of got the right idea. Let's look at two examples:

Ex A:
Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")

Ex B:
Dim obj As MyComp.MyClass
obj = CreateObject("MyComp.MyClass", "MyServer")

The variable in Ex A is late bound. The compiler knows that it will refer to
an object but it has no idea what kind of object thus all calls to methods
or properties will be resolved at run time.

The variable in Ex B is early bound. The compiler knows it is refering to an
object of type MyClass and will use the metadata from the assembly (which
was generated from the type library of the COM component) to validate all
calls to methods or properties at compile time.

Hope this helps,

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If I early bind a reference locally can I use it like this?
Dim obj As Object

dim param1 as MyComp.MyClass.MyType
dim param2 as boolean = false
dim intReturn as integer

param1.int1 = 1
param1.string1 = "trial and error"
param1.int2 = 3
obj = CreateObject("MyComp.MyClass", "MyServer")
' use object

intReturn = obj.myfunction(param1,param2)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
obj = Nothing

Note this code shows how to use the object late bound and requires Option
Strict Off. You can do this early bound by setting a reference to your
component and using a variable to the correct type, this would of course

be
preferred.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
This is what I understand. What I don't understand is how I make the
program go to the MTS server (another machine) for all the calls..
I got some advice from AlexFeinman_MVP on the chat about smartdevices

today,
but by the time I was able to try it out, I was unable to call any of my functions. I think it is that I am just unable to understand this area because it has been thrown on me and I am just learning web services. Can you help shed some light.
Thank you,
Daryl
<snip from chat>
AlexFeinman_MVP : Q: How do I write a web service that uses a remote MTS
component written in VB6 (using late binding)
AlexFeinman_MVP : A: Use Dim t as Type =
Type.GetFromProgID(componentProgID) to obtain a runtime type and then
Activator.CreateInstance to create an instance of the component. Once you have an instance, use Type.InvokeMember to call methods.properties by name AlexFeinman_MVP : .

"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in
message news:e5****************@TK2MSFTNGP12.phx.gbl...
> Hi Daryl,
>
> .NET handles that for you! If you're using Visual Studio just go to

the "Add
> Reference" dialog and pick your VB 6 DLL from the list in the COM tab. > Visual Studio will create a .NET DLL wrapper for you automatically.
>
> You you're not using VS then you need to use the tlbimp.exe command line > utility which is part of the .NET Framework SDK. See the link below for more
> info on this utility
>
>

http://msdn.microsoft.com/library/de...rTlbimpexe.asp
>
> --
> Rob Windsor [MVP-VB]
> G6 Consulting
> Toronto, Canada
>
>
> "Daryl Davis" <th***********@hotmail.com> wrote in message
> news:O$**************@TK2MSFTNGP11.phx.gbl...
> > What I want to do....
> > is write a .net dll to call vb6 dll's so that i have it wrapped so to > speak.
> > Daryl
> >
> > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in

message
> > news:em**************@TK2MSFTNGP10.phx.gbl...
> > > You can use VB.NET (or C#) to create the equivalent to a VB 6

ActiveX
> DLL
> > > using COM Interop. These DLLs could be used by .NET apps or VB (more > > > specificaly COM) apps. NOTE: If you want to create a DLL in VB.NET that
> > will
> > > be used by a VB 6 front-end you will need to deploy the .NET

Framework
> to
> > > the machines that will use the DLL.
> > >
> > > --
> > > Rob Windsor [MVP-VB]
> > > G6 Consulting
> > > Toronto, Canada
> > >
> > >
> > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > news:Oe**************@tk2msftngp13.phx.gbl...
> > > > Can I still write dll files in Visual basic.net?
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Jul 21 '05 #9
Rob,
Then my problem must be that I am trying from a web service, or I am missing
something very basic. When I try to early bind I get the error "
Cannot convert to 'Interface salesDO'.
"
SalesDO is the class on the dll I am trying to call.
and when I try late binding and try call I get "
Run-time exception thrown : System.NullReferenceException - Object reference
not set to an instance of an object.
"
My test code (usually typed out in command window but here for example)....
try
Dim trying as hallsales.salesdo
dim sale as object
trying = createobject("hallsales.salesdo","\\192.168.10.1")
sale = createobject("hallsales.salesdo","\\192.168.10.1")
input = hallsales.saleTable2
input.CreditAmt = 20

input.posStation = 9

input.UserID = 5

trying.sellfrompos(input,true)
sale.sellfrompos(input,true)
catch ex
end try

Do you have any ideas? I know I must be missing something small, but
important.
Daryl Davis
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
You've kind of got the right idea. Let's look at two examples:

Ex A:
Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")

Ex B:
Dim obj As MyComp.MyClass
obj = CreateObject("MyComp.MyClass", "MyServer")

The variable in Ex A is late bound. The compiler knows that it will refer to an object but it has no idea what kind of object thus all calls to methods
or properties will be resolved at run time.

The variable in Ex B is early bound. The compiler knows it is refering to an object of type MyClass and will use the metadata from the assembly (which
was generated from the type library of the COM component) to validate all
calls to methods or properties at compile time.

Hope this helps,

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If I early bind a reference locally can I use it like this?
Dim obj As Object dim param1 as MyComp.MyClass.MyType
dim param2 as boolean = false
dim intReturn as integer

param1.int1 = 1
param1.string1 = "trial and error"
param1.int2 = 3
obj = CreateObject("MyComp.MyClass", "MyServer")
' use object

intReturn = obj.myfunction(param1,param2)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
obj = Nothing

Note this code shows how to use the object late bound and requires Option Strict Off. You can do this early bound by setting a reference to your
component and using a variable to the correct type, this would of course
be
preferred.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
> This is what I understand. What I don't understand is how I make
the > program go to the MTS server (another machine) for all the calls..
> I got some advice from AlexFeinman_MVP on the chat about smartdevices today,
> but by the time I was able to try it out, I was unable to call any of my > functions. I think it is that I am just unable to understand this area > because it has been thrown on me and I am just learning web
services.
Can
> you help shed some light.
> Thank you,
> Daryl
> <snip from chat>
> AlexFeinman_MVP : Q: How do I write a web service that uses a remote MTS
> component written in VB6 (using late binding)
> AlexFeinman_MVP : A: Use Dim t as Type =
> Type.GetFromProgID(componentProgID) to obtain a runtime type and
then > Activator.CreateInstance to create an instance of the component. Once you
> have an instance, use Type.InvokeMember to call methods.properties
by name
> AlexFeinman_MVP : .
>
> "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message > news:e5****************@TK2MSFTNGP12.phx.gbl...
> > Hi Daryl,
> >
> > .NET handles that for you! If you're using Visual Studio just go
to the
> "Add
> > Reference" dialog and pick your VB 6 DLL from the list in the COM tab. > > Visual Studio will create a .NET DLL wrapper for you
automatically. > >
> > You you're not using VS then you need to use the tlbimp.exe command line
> > utility which is part of the .NET Framework SDK. See the link
below for
> more
> > info on this utility
> >
> >
>

http://msdn.microsoft.com/library/de...rTlbimpexe.asp > >
> > --
> > Rob Windsor [MVP-VB]
> > G6 Consulting
> > Toronto, Canada
> >
> >
> > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > news:O$**************@TK2MSFTNGP11.phx.gbl...
> > > What I want to do....
> > > is write a .net dll to call vb6 dll's so that i have it wrapped
so to
> > speak.
> > > Daryl
> > >
> > > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in
message
> > > news:em**************@TK2MSFTNGP10.phx.gbl...
> > > > You can use VB.NET (or C#) to create the equivalent to a VB 6
ActiveX
> > DLL
> > > > using COM Interop. These DLLs could be used by .NET apps or VB

(more
> > > > specificaly COM) apps. NOTE: If you want to create a DLL in

VB.NET > that
> > > will
> > > > be used by a VB 6 front-end you will need to deploy the .NET
Framework
> > to
> > > > the machines that will use the DLL.
> > > >
> > > > --
> > > > Rob Windsor [MVP-VB]
> > > > G6 Consulting
> > > > Toronto, Canada
> > > >
> > > >
> > > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > > news:Oe**************@tk2msftngp13.phx.gbl...
> > > > > Can I still write dll files in Visual basic.net?
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Jul 21 '05 #10
sorry input = hallsales.saleTable2 is supposed to be
dim input as hallsales.saletable2
Daryl
"Daryl Davis" <th***********@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
Rob,
Then my problem must be that I am trying from a web service, or I am missing something very basic. When I try to early bind I get the error "
Cannot convert to 'Interface salesDO'.
"
SalesDO is the class on the dll I am trying to call.
and when I try late binding and try call I get "
Run-time exception thrown : System.NullReferenceException - Object reference not set to an instance of an object.
"
My test code (usually typed out in command window but here for example).... try
Dim trying as hallsales.salesdo
dim sale as object
trying = createobject("hallsales.salesdo","\\192.168.10.1")
sale = createobject("hallsales.salesdo","\\192.168.10.1")
input = hallsales.saleTable2
input.CreditAmt = 20

input.posStation = 9

input.UserID = 5

trying.sellfrompos(input,true)
sale.sellfrompos(input,true)
catch ex
end try

Do you have any ideas? I know I must be missing something small, but
important.
Daryl Davis
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
You've kind of got the right idea. Let's look at two examples:

Ex A:
Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")

Ex B:
Dim obj As MyComp.MyClass
obj = CreateObject("MyComp.MyClass", "MyServer")

The variable in Ex A is late bound. The compiler knows that it will refer
to
an object but it has no idea what kind of object thus all calls to methods or properties will be resolved at run time.

The variable in Ex B is early bound. The compiler knows it is refering to
an
object of type MyClass and will use the metadata from the assembly
(which was generated from the type library of the COM component) to validate all calls to methods or properties at compile time.

Hope this helps,

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If I early bind a reference locally can I use it like this?

> Dim obj As Object
dim param1 as MyComp.MyClass.MyType
dim param2 as boolean = false
dim intReturn as integer

param1.int1 = 1
param1.string1 = "trial and error"
param1.int2 = 3

> obj = CreateObject("MyComp.MyClass", "MyServer")
> ' use object
intReturn = obj.myfunction(param1,param2)
> System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
> obj = Nothing
>
> Note this code shows how to use the object late bound and requires

Option
> Strict Off. You can do this early bound by setting a reference to your > component and using a variable to the correct type, this would of course be
> preferred.
>
> Rob
>
>
>
> "Daryl Davis" <th***********@hotmail.com> wrote in message
> news:e9**************@tk2msftngp13.phx.gbl...
> > This is what I understand. What I don't understand is how I make the > > program go to the MTS server (another machine) for all the calls..
> > I got some advice from AlexFeinman_MVP on the chat about smartdevices > today,
> > but by the time I was able to try it out, I was unable to call any of
my
> > functions. I think it is that I am just unable to understand this

area
> > because it has been thrown on me and I am just learning web

services. Can
> > you help shed some light.
> > Thank you,
> > Daryl
> > <snip from chat>
> > AlexFeinman_MVP : Q: How do I write a web service that uses a

remote
> MTS
> > component written in VB6 (using late binding)
> > AlexFeinman_MVP : A: Use Dim t as Type =
> > Type.GetFromProgID(componentProgID) to obtain a runtime type and then > > Activator.CreateInstance to create an instance of the component. Once you
> > have an instance, use Type.InvokeMember to call methods.properties by name
> > AlexFeinman_MVP : .
> >
> > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in

message
> > news:e5****************@TK2MSFTNGP12.phx.gbl...
> > > Hi Daryl,
> > >
> > > .NET handles that for you! If you're using Visual Studio just go to the
> > "Add
> > > Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
> > > Visual Studio will create a .NET DLL wrapper for you automatically. > > >
> > > You you're not using VS then you need to use the tlbimp.exe command line
> > > utility which is part of the .NET Framework SDK. See the link below for
> > more
> > > info on this utility
> > >
> > >
> >
>

http://msdn.microsoft.com/library/de...rTlbimpexe.asp > > >
> > > --
> > > Rob Windsor [MVP-VB]
> > > G6 Consulting
> > > Toronto, Canada
> > >
> > >
> > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > news:O$**************@TK2MSFTNGP11.phx.gbl...
> > > > What I want to do....
> > > > is write a .net dll to call vb6 dll's so that i have it wrapped so
to
> > > speak.
> > > > Daryl
> > > >
> > > > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote

in > message
> > > > news:em**************@TK2MSFTNGP10.phx.gbl...
> > > > > You can use VB.NET (or C#) to create the equivalent to a VB 6 > ActiveX
> > > DLL
> > > > > using COM Interop. These DLLs could be used by .NET apps or VB (more
> > > > > specificaly COM) apps. NOTE: If you want to create a DLL in

VB.NET
> > that
> > > > will
> > > > > be used by a VB 6 front-end you will need to deploy the .NET
> Framework
> > > to
> > > > > the machines that will use the DLL.
> > > > >
> > > > > --
> > > > > Rob Windsor [MVP-VB]
> > > > > G6 Consulting
> > > > > Toronto, Canada
> > > > >
> > > > >
> > > > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > > > news:Oe**************@tk2msftngp13.phx.gbl...
> > > > > > Can I still write dll files in Visual basic.net?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Jul 21 '05 #11
Hi Daryl,

Sorry, I'm out of ideas. I'd guess it was a security issue but the error
messages you're getting don't point to that.

The last thing I would suggest is to create a small VB 6 test app that calls
your component, get that working then copy the code over to a test VB.NET
app and get that working (it should without any changes). Once your sure
that you can access your component using a windows app then you can narrow
down the possible problems.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
Rob,
Then my problem must be that I am trying from a web service, or I am missing something very basic. When I try to early bind I get the error "
Cannot convert to 'Interface salesDO'.
"
SalesDO is the class on the dll I am trying to call.
and when I try late binding and try call I get "
Run-time exception thrown : System.NullReferenceException - Object reference not set to an instance of an object.
"
My test code (usually typed out in command window but here for example).... try
Dim trying as hallsales.salesdo
dim sale as object
trying = createobject("hallsales.salesdo","\\192.168.10.1")
sale = createobject("hallsales.salesdo","\\192.168.10.1")
input = hallsales.saleTable2
input.CreditAmt = 20

input.posStation = 9

input.UserID = 5

trying.sellfrompos(input,true)
sale.sellfrompos(input,true)
catch ex
end try

Do you have any ideas? I know I must be missing something small, but
important.
Daryl Davis
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
You've kind of got the right idea. Let's look at two examples:

Ex A:
Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")

Ex B:
Dim obj As MyComp.MyClass
obj = CreateObject("MyComp.MyClass", "MyServer")

The variable in Ex A is late bound. The compiler knows that it will refer
to
an object but it has no idea what kind of object thus all calls to methods or properties will be resolved at run time.

The variable in Ex B is early bound. The compiler knows it is refering to
an
object of type MyClass and will use the metadata from the assembly
(which was generated from the type library of the COM component) to validate all calls to methods or properties at compile time.

Hope this helps,

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If I early bind a reference locally can I use it like this?

> Dim obj As Object
dim param1 as MyComp.MyClass.MyType
dim param2 as boolean = false
dim intReturn as integer

param1.int1 = 1
param1.string1 = "trial and error"
param1.int2 = 3

> obj = CreateObject("MyComp.MyClass", "MyServer")
> ' use object
intReturn = obj.myfunction(param1,param2)
> System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
> obj = Nothing
>
> Note this code shows how to use the object late bound and requires

Option
> Strict Off. You can do this early bound by setting a reference to your > component and using a variable to the correct type, this would of course be
> preferred.
>
> Rob
>
>
>
> "Daryl Davis" <th***********@hotmail.com> wrote in message
> news:e9**************@tk2msftngp13.phx.gbl...
> > This is what I understand. What I don't understand is how I make the > > program go to the MTS server (another machine) for all the calls..
> > I got some advice from AlexFeinman_MVP on the chat about smartdevices > today,
> > but by the time I was able to try it out, I was unable to call any of
my
> > functions. I think it is that I am just unable to understand this

area
> > because it has been thrown on me and I am just learning web

services. Can
> > you help shed some light.
> > Thank you,
> > Daryl
> > <snip from chat>
> > AlexFeinman_MVP : Q: How do I write a web service that uses a

remote
> MTS
> > component written in VB6 (using late binding)
> > AlexFeinman_MVP : A: Use Dim t as Type =
> > Type.GetFromProgID(componentProgID) to obtain a runtime type and then > > Activator.CreateInstance to create an instance of the component. Once you
> > have an instance, use Type.InvokeMember to call methods.properties by name
> > AlexFeinman_MVP : .
> >
> > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in

message
> > news:e5****************@TK2MSFTNGP12.phx.gbl...
> > > Hi Daryl,
> > >
> > > .NET handles that for you! If you're using Visual Studio just go to the
> > "Add
> > > Reference" dialog and pick your VB 6 DLL from the list in the COM tab.
> > > Visual Studio will create a .NET DLL wrapper for you automatically. > > >
> > > You you're not using VS then you need to use the tlbimp.exe command line
> > > utility which is part of the .NET Framework SDK. See the link below for
> > more
> > > info on this utility
> > >
> > >
> >
>

http://msdn.microsoft.com/library/de...rTlbimpexe.asp > > >
> > > --
> > > Rob Windsor [MVP-VB]
> > > G6 Consulting
> > > Toronto, Canada
> > >
> > >
> > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > news:O$**************@TK2MSFTNGP11.phx.gbl...
> > > > What I want to do....
> > > > is write a .net dll to call vb6 dll's so that i have it wrapped so
to
> > > speak.
> > > > Daryl
> > > >
> > > > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote

in > message
> > > > news:em**************@TK2MSFTNGP10.phx.gbl...
> > > > > You can use VB.NET (or C#) to create the equivalent to a VB 6 > ActiveX
> > > DLL
> > > > > using COM Interop. These DLLs could be used by .NET apps or VB (more
> > > > > specificaly COM) apps. NOTE: If you want to create a DLL in

VB.NET
> > that
> > > > will
> > > > > be used by a VB 6 front-end you will need to deploy the .NET
> Framework
> > > to
> > > > > the machines that will use the DLL.
> > > > >
> > > > > --
> > > > > Rob Windsor [MVP-VB]
> > > > > G6 Consulting
> > > > > Toronto, Canada
> > > > >
> > > > >
> > > > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > > > news:Oe**************@tk2msftngp13.phx.gbl...
> > > > > > Can I still write dll files in Visual basic.net?
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Jul 21 '05 #12
Thanks Rob.
I appreciate all your help. Hopefully someone in the webservice group can
help me then.
Daryl
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:ej**************@tk2msftngp13.phx.gbl...
Hi Daryl,

Sorry, I'm out of ideas. I'd guess it was a security issue but the error
messages you're getting don't point to that.

The last thing I would suggest is to create a small VB 6 test app that calls your component, get that working then copy the code over to a test VB.NET
app and get that working (it should without any changes). Once your sure
that you can access your component using a windows app then you can narrow
down the possible problems.

Rob

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
Rob,
Then my problem must be that I am trying from a web service, or I am missing
something very basic. When I try to early bind I get the error "
Cannot convert to 'Interface salesDO'.
"
SalesDO is the class on the dll I am trying to call.
and when I try late binding and try call I get "
Run-time exception thrown : System.NullReferenceException - Object

reference
not set to an instance of an object.
"
My test code (usually typed out in command window but here for

example)....
try
Dim trying as hallsales.salesdo
dim sale as object
trying = createobject("hallsales.salesdo","\\192.168.10.1")
sale = createobject("hallsales.salesdo","\\192.168.10.1")
input = hallsales.saleTable2
input.CreditAmt = 20

input.posStation = 9

input.UserID = 5

trying.sellfrompos(input,true)
sale.sellfrompos(input,true)
catch ex
end try

Do you have any ideas? I know I must be missing something small, but
important.
Daryl Davis
"Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
You've kind of got the right idea. Let's look at two examples:

Ex A:
Dim obj As Object
obj = CreateObject("MyComp.MyClass", "MyServer")

Ex B:
Dim obj As MyComp.MyClass
obj = CreateObject("MyComp.MyClass", "MyServer")

The variable in Ex A is late bound. The compiler knows that it will refer
to
an object but it has no idea what kind of object thus all calls to methods or properties will be resolved at run time.

The variable in Ex B is early bound. The compiler knows it is refering to
an
object of type MyClass and will use the metadata from the assembly

(which was generated from the type library of the COM component) to validate all calls to methods or properties at compile time.

Hope this helps,

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada

"Daryl Davis" <th***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> If I early bind a reference locally can I use it like this?
>
> > Dim obj As Object
> dim param1 as MyComp.MyClass.MyType
> dim param2 as boolean = false
> dim intReturn as integer
>
> param1.int1 = 1
> param1.string1 = "trial and error"
> param1.int2 = 3
>
> > obj = CreateObject("MyComp.MyClass", "MyServer")
> > ' use object
> intReturn = obj.myfunction(param1,param2)
> > System.Runtime.InteropServices.Marshal.ReleaseComO bject(obj)
> > obj = Nothing
> >
> > Note this code shows how to use the object late bound and requires
Option
> > Strict Off. You can do this early bound by setting a reference to your > > component and using a variable to the correct type, this would of

course
> be
> > preferred.
> >
> > Rob
> >
> >
> >
> > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > news:e9**************@tk2msftngp13.phx.gbl...
> > > This is what I understand. What I don't understand is how I make the
> > > program go to the MTS server (another machine) for all the
calls.. > > > I got some advice from AlexFeinman_MVP on the chat about

smartdevices
> > today,
> > > but by the time I was able to try it out, I was unable to call any
of
my
> > > functions. I think it is that I am just unable to understand
this area
> > > because it has been thrown on me and I am just learning web

services.
> Can
> > > you help shed some light.
> > > Thank you,
> > > Daryl
> > > <snip from chat>
> > > AlexFeinman_MVP : Q: How do I write a web service that uses a
remote
> > MTS
> > > component written in VB6 (using late binding)
> > > AlexFeinman_MVP : A: Use Dim t as Type =
> > > Type.GetFromProgID(componentProgID) to obtain a runtime type and

then
> > > Activator.CreateInstance to create an instance of the component.

Once
> you
> > > have an instance, use Type.InvokeMember to call methods.properties by
> name
> > > AlexFeinman_MVP : .
> > >
> > > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in
message
> > > news:e5****************@TK2MSFTNGP12.phx.gbl...
> > > > Hi Daryl,
> > > >
> > > > .NET handles that for you! If you're using Visual Studio just
go to
> the
> > > "Add
> > > > Reference" dialog and pick your VB 6 DLL from the list in the

COM tab.
> > > > Visual Studio will create a .NET DLL wrapper for you

automatically.
> > > >
> > > > You you're not using VS then you need to use the tlbimp.exe

command
> line
> > > > utility which is part of the .NET Framework SDK. See the link

below
> for
> > > more
> > > > info on this utility
> > > >
> > > >
> > >
> >
>

http://msdn.microsoft.com/library/de...rTlbimpexe.asp > > > >
> > > > --
> > > > Rob Windsor [MVP-VB]
> > > > G6 Consulting
> > > > Toronto, Canada
> > > >
> > > >
> > > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > > news:O$**************@TK2MSFTNGP11.phx.gbl...
> > > > > What I want to do....
> > > > > is write a .net dll to call vb6 dll's so that i have it wrapped
so
> to
> > > > speak.
> > > > > Daryl
> > > > >
> > > > > "Rob Windsor [MVP]" <rw******@NO.MORE.SPAM.bigfoot.com> wrote in > > message
> > > > > news:em**************@TK2MSFTNGP10.phx.gbl...
> > > > > > You can use VB.NET (or C#) to create the equivalent to a
VB
6 > > ActiveX
> > > > DLL
> > > > > > using COM Interop. These DLLs could be used by .NET apps
or
VB > (more
> > > > > > specificaly COM) apps. NOTE: If you want to create a DLL

in VB.NET
> > > that
> > > > > will
> > > > > > be used by a VB 6 front-end you will need to deploy the ..NET > > Framework
> > > > to
> > > > > > the machines that will use the DLL.
> > > > > >
> > > > > > --
> > > > > > Rob Windsor [MVP-VB]
> > > > > > G6 Consulting
> > > > > > Toronto, Canada
> > > > > >
> > > > > >
> > > > > > "Daryl Davis" <th***********@hotmail.com> wrote in message
> > > > > > news:Oe**************@tk2msftngp13.phx.gbl...
> > > > > > > Can I still write dll files in Visual basic.net?
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Jul 21 '05 #13

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

Similar topics

2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
18
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
3
by: pooja | last post by:
Suppose i have created a class c1 with f1()in c1.cpp and included this c1.cpp in file1.cpp file , which is also having main() by giving the statement #include "c1.cpp". the same i can do by...
11
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
0
by: wal | last post by:
How does one attach files to emails using libgmail? The following code http://pramode.net/articles/lfy/fuse/4.txt works fine when said files are simple text files, but it failes as soon as the...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.