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

Late Binding .....

Hi,

Can I Late binding to object in .NET ( not COM objects, Objects was created
vb.net Dll ) !!!
<<< CreateObject("MyDLLName.dll","MyClassName") or
CreateActiveX("MyDLLName.dll","MyClassName") >>>
When I running this codes I have a error "ActiveX can not create" !

Thanks for help...
Hakan Örnek


Jan 24 '07 #1
7 6773
"Hakan ÖRNEK" <or****@gmail.comschrieb
Hi,

Can I Late binding to object in .NET ( not COM objects, Objects was
created vb.net Dll ) !!!
<<< CreateObject("MyDLLName.dll","MyClassName") or
CreateActiveX("MyDLLName.dll","MyClassName") >>>
When I running this codes I have a error "ActiveX can not create" !

http://msdn2.microsoft.com/en-us/library/k3a58006.aspx
Armin

Jan 24 '07 #2
Armin,
Thanks for your link, but for custom binding methods required add referance
from dll.
<Imports Simple_Type.Simple_Type>
I dont want to add referance from created object dll.
Can I use Createobject() method like a vbscript codes;

dim o as object
SET o=CreateObject("MyDll.dll","MyClass")
call o.TestMethod()

Thank for your helps...

Hakan

"Armin Zingler" <az*******@freenet.dewrote in message
news:Oj****************@TK2MSFTNGP02.phx.gbl...
"Hakan ÖRNEK" <or****@gmail.comschrieb
Hi,

Can I Late binding to object in .NET ( not COM objects, Objects was
created vb.net Dll ) !!!
<<< CreateObject("MyDLLName.dll","MyClassName") or
CreateActiveX("MyDLLName.dll","MyClassName") >>>
When I running this codes I have a error "ActiveX can not create" !


http://msdn2.microsoft.com/en-us/library/k3a58006.aspx
Armin

Jan 25 '07 #3
"Hakan ÖRNEK" <or****@gmail.comschrieb
Armin,
Thanks for your link, but for custom binding methods required add
referance from dll.
<Imports Simple_Type.Simple_Type>
I dont want to add referance from created object dll.
Can I use Createobject() method like a vbscript codes;

dim o as object
SET o=CreateObject("MyDll.dll","MyClass")
call o.TestMethod()

Thank for your helps...

Maybe I didn't understand you correctly. You wrote a VB.Net dll. It is not a
COM dll. In a client application, you want to create objects from classes in
the dll, right? Using the methods described in the topics from the link, you
are able to do it without using "Imports" or Createobject. Much can be said
about it but I only mention System.Reflection.Assembly.Load and
System.Type.InvokeMember.
Armin

Jan 25 '07 #4
Hakan ÖRNEK wrote:
Armin,
Thanks for your link, but for custom binding methods required add referance
from dll.
<Imports Simple_Type.Simple_Type>
I dont want to add referance from created object dll.
Can I use Createobject() method like a vbscript codes;

dim o as object
SET o=CreateObject("MyDll.dll","MyClass")
call o.TestMethod()
<snip>

The CreateObject() function works only with COM libraries. Therefore,
it seems you'd need to have your original .Net MyDll.dll registered in
the COM framework, first.

You need to mark the relevant class (in your case, "MyClass", although
this is a reserved name, I suppose you only used it as an example), I
was saying, you need to mark the relevant class as both "COM class" and
"COM visible" -- select the class in the project/solution explorer and
these options will become available.

Then you need to enable the "Make Assembly COM visible flag": open the
project properties and click the "Assembly Information..." button in
the Applcation tab.

Finaly, after the dll is compiled, you must register it in the COM
framework. To this, use the regasm application (I guess you can
download it with the .Net SDK):

regasm /codebase "your dll path"

Finally, inside your client application you'd use (notice that I don't
have VB.Classic installed here, so I can't confirm the syntax):
dim o as object
Set o=CreateObject("MyDll.dll.MyClass")
call o.TestMethod()
HTH.

Regards,

Branco.

Jan 25 '07 #5
Hi,
Actualy I want to write vb script in my code, for example;
'----------------------------------
Public Class TestClass
Public Sub HelloWorld()
MsgBox("Hello World")
End Sub
End Class
'----------------------------------
Compile this code and create Test.Dll
And then, create New Application Test.exe and not to add referance Test.Dll.
'----------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oTest As Object
oTest = CreateObject("Test.TestClass")
oTest.HelloWorld()
End Sub
'----------------------------------

In VB6 Test.dll compiled automaticly register and Latebind in Dll name (Test.dll) and public class (TestClass), but I think so VB.NET dll not registered in registery so how can I do this case, I want to run my code like script.

Thanks for helps again,

Hakan


"Armin Zingler" <az*******@freenet.dewrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
"Hakan ÖRNEK" <or****@gmail.comschrieb
Armin,
Thanks for your link, but for custom binding methods required add
referance from dll.
<Imports Simple_Type.Simple_Type>
I dont want to add referance from created object dll.
Can I use Createobject() method like a vbscript codes;

dim o as object
SET o=CreateObject("MyDll.dll","MyClass")
call o.TestMethod()

Thank for your helps...

Maybe I didn't understand you correctly. You wrote a VB.Net dll. It is not a
COM dll. In a client application, you want to create objects from classes in
the dll, right? Using the methods described in the topics from the link, you
are able to do it without using "Imports" or Createobject. Much can be said
about it but I only mention System.Reflection.Assembly.Load and
System.Type.InvokeMember.
Armin
Jan 26 '07 #6
Hi Branco,
Thanks for advices, It worked... :)))
Only "assembly a strong name" and cliend dll was same directory required.
Thanks for all helps.....
Best regards,

Hakan


"Branco Medeiros" <br*************@gmail.comwrote in message
news:11**********************@k78g2000cwa.googlegr oups.com...
Hakan ÖRNEK wrote:
Armin,
Thanks for your link, but for custom binding methods required add
referance
from dll.
<Imports Simple_Type.Simple_Type>
I dont want to add referance from created object dll.
Can I use Createobject() method like a vbscript codes;

dim o as object
SET o=CreateObject("MyDll.dll","MyClass")
call o.TestMethod()
<snip>

The CreateObject() function works only with COM libraries. Therefore,
it seems you'd need to have your original .Net MyDll.dll registered in
the COM framework, first.

You need to mark the relevant class (in your case, "MyClass", although
this is a reserved name, I suppose you only used it as an example), I
was saying, you need to mark the relevant class as both "COM class" and
"COM visible" -- select the class in the project/solution explorer and
these options will become available.

Then you need to enable the "Make Assembly COM visible flag": open the
project properties and click the "Assembly Information..." button in
the Applcation tab.

Finaly, after the dll is compiled, you must register it in the COM
framework. To this, use the regasm application (I guess you can
download it with the .Net SDK):

regasm /codebase "your dll path"

Finally, inside your client application you'd use (notice that I don't
have VB.Classic installed here, so I can't confirm the syntax):
dim o as object
Set o=CreateObject("MyDll.dll.MyClass")
call o.TestMethod()
HTH.

Regards,

Branco.
Jan 26 '07 #7
"Hakan ÖRNEK" <or****@gmail.comschrieb
Hi,
Actualy I want to write vb script in my code, for example;
'----------------------------------
Public Class TestClass
Public Sub HelloWorld()
MsgBox("Hello World")
End Sub
End Class
'----------------------------------
Compile this code and create Test.Dll
And then, create New Application Test.exe and not to add referance
Test.Dll.
'----------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oTest As Object
oTest = CreateObject("Test.TestClass")
oTest.HelloWorld()
End Sub
'----------------------------------

In VB6 Test.dll compiled automaticly register and Latebind in Dll
name (Test.dll) and public class (TestClass), but I think so VB.NET
dll not registered in registery so how can I do this case, I want
to run my code like script.

Thanks for helps again,

Hakan
There is nothing more I can add to what I've already said, sorry. The topics
in the documentation desribe in detail how to do it.
Armin

Jan 26 '07 #8

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

Similar topics

21
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: *********************************************************...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
14
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs...
9
by: Zlatko Matiæ | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
5
by: eBob.com | last post by:
In another thread VJ made me aware of Tag. Fantastic! I've been wanting this capability for a long time. But it seems that I cannot use it with Option Strict On. In an event handler I have ......
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
6
by: Tim Roberts | last post by:
I've been doing COM a long time, but I've just come across a behavior with late binding that surprises me. VB and VBS are not my normal milieux, so I'm hoping someone can point me to a document...
2
by: GS | last post by:
I have installed the ms PIA for ofc XP, and followed the article http://support.microsoft.com/kb/247412/ trying to paste into a worksheet However I got late binding not allowed errors .......
3
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile...
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.