TheSwamp
Code Red => .NET => Topic started by: www1970 on July 21, 2006, 04:51:13 AM
-
I used VB NET develop objectArx , then I want to put some common functions in a "MYLIB" dll, load then in other programl, but I tryed N times , failed ! I don't know if to set some things in VBNET, or set the DLL functions to "shared"。please give me a detailed step. thanks before!
english not well :-o
-
reinforce more
for example:
a object is:
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Public Class hw
<Autodesk.AutoCAD.Runtime.CommandMethod("Hello")> _
Public Shared Sub HelloWorld()
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Hello World")
End Sub
End Class
compile to "HW.dll"
the second example :
new a class1 object
first “Add Reference” "HW.dll"
Imports HW
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Public Class Class1
<Autodesk.AutoCAD.Runtime.CommandMethod("Example")> _
Public Shared Sub Example()
Dim exp as HW
exp.Hello
End Sub
End Class
-
hi www1970, welcome to theswamp.
Unfortunately I know nothing about programming. There are many very good programmers that visit the site on a daily basis, but they havent logged on just yet today. I'm sure someone will be along shortly to help you.
Kind regards
Tracey
-
Try exo.HelloWorld .. which is the name of the method of the hw class.
Hello is the registered command to be used from the command AutoCAD line
-
I don't think that will work as you're trying to call a registered command from another registered command, for some reason...
-
You should still be able to call the method (HelloWorld in this case) all the same, the command method attribute is just the acad 'export' of the method for the command stack.
I don't know about vb but maybe a 'Set' is required for a new instance of exo??
Or-
if 'shared' is the same as static, you would need to call hw.HelloWorld, not HW which is what he is trying to create that doesn't exist, the class declaration is 'hw'
-
Triple Aussied...Nice.
Quadruple if you count Jonesy and subscribe to the belief that Brits are just Aussies who didn't get caught.
-
thanks for everyone
though my problem isnot solved,but I am inspired by everybody
-
Congratulate! solved
Public Sub Example()
Dim exp As HW = New HW
exp.HelloWorld()
End Sub
first: exp.HelloWorld()
second: New HW
not need define shared
-
Try exo.HelloWorld .. which is the name of the method of the hw class.
Hello is the registered command to be used from the command AutoCAD line
DUH ! I forgot the parenthesis
exo.HelloWorld ( )
now thats a silly thing for an old lisper to do :lol:
-
Kerry Brown
not silly,thank you wery much!