|
I use VB.NET to write a class library.
There is three classes for calling some functions,
and I have check the project property page,
Configuration Properties, Builds, Register for COM interop.
So, a .tbl file is generated when compile and build the project.
This file is for VBA to call this class library function.
I have tried to make reference to this .tbl file and call those function.
It works fine.
However, after I modify the class library and recompile the file,
the vba got an error.
But when I drop the item on refernece list and find out the .tbl for reference again,
The vba can run again.
How can I run the vba without reference again the .tbl?
Thanks!
|
|
|
|
|
(Assuming Visual Studio.NET 2003 here...) Part of your problem may be the fact that every time you compile your library your allowing the version umber to change. Open the library's AssemblyInfo.vb file. At the bottom, you'll see something like this:
<Assembly: AssemblyVersion("1.0.*")>
See the '*' in the version number? That's allowing the compiler to automatically increment the version number in your library.
When you reference a component, one of the things that is very important in the registration is the version. If you change the version of the component though, the reference is no longer valid, unless that version still exists.
Change that line in AssemblyInfo.vb to something like this:
<Assembly: AssemblyVersion("1.0.0.1")>
Change the version info by hand, if needed, during development. This will keep all builds of your component the same version number.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Really Thank you to let me know this.
I have tried this but the same error is still here.
The error message said that the macro is stoped, please reference the help and find out the way to open the macro.
|
|
|
|
|
What error? Macro? What macro? You never said anything about a macro...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using Excel macro to reference the .tbl
The macro is really simple,
<br />
Sub a()<br />
Dim b As mydll.myclass<br />
Set b = New mydll.myclass<br />
<br />
b.myClassFunction<br />
End Sub<br />
b.myClassFunction runs fine when the first time,
after I modify and rebuild the mydll by VS2003,
the macro runs error.
b.myClassFunction just a msgbox("a") and I change to msgbox("b")
|
|
|
|
|
Curious...
When you created your component library, did you just enble the "Register for COM Interop" checkbox in your project properties?
Did you attribute your class with the ComClass attribute? Like this:
<ComClass(TestClass.ClassId, TestClass.InterfaceId, TestClass.EventsId)> _
Public Class TestClass
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "38605A8E-9541-4E06-8E7E-6E07A4D67B8F"
Public Const InterfaceId As String = "22719D76-0322-4EC0-A100-95246F0F866E"
Public Const EventsId As String = "1AECF045-F034-4C92-9A62-83C56072E56C"
Public Sub New()
MyBase.New()
End Sub
Public Sub ShowMe()
MsgBox("This is the component!!!!!!")
End Sub
End Class
If not, this is probably why your component doesn't work every time you change something.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you first, I always see this ID in VS2003,
Does this ID generated by VS randomly?
Can I just copy this ID for my COM use?
Thank you again!
|
|
|
|
|
You COULD use it, but I would recommend you generate your own GUIDs.
Each class must have it's own unique GUID.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You can learn more about this here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have try your advise.
There is a bit difference at all,
That is, When I using the class in VBA,
there is a list of public function in that class for me to choose.
This is no before adding the IDs.
However, The problem is still here.
Error after rebuild the COM.
Further information,
In my Class Library project, I have three classes and one window form.
In my test case in VBA, I have just using one class, and so I just adding the IDs to that class.
any other advise?
anyway, Thank you so much again!
|
|
|
|
|
cylix2000 wrote: Error after rebuild the COM.
And that would be???
cylix2000 wrote: In my Class Library project, I have three classes and one window form.
In my test case in VBA, I have just using one class, and so I just adding the IDs to that class.
any other advise?
You need to add different GUIDs to each class you want visible to COM. No two classes can have the same GUID.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have tried to make all these class with distinct IDs,
but the error still ...
|
|
|
|
|
And that error is??
I have no clue what's wrong, other than possibly you have multiple versions of your component registered, but only one file that is valid. You could have an old version of the component still registered with the same name, but different GUIDs. You might have to go through the registry and track down every key that mentions your component and delete them from the registry. If you don't know what your doing with this part, DO NOT EVEN ATTEMPT to do this. Just change the GUIDs your using and the names of the library and classes in your component.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using VS 2003. I have different options to be given for each item in the data grid. One option is I can provide Boolean column which will give me check box in each optional column and validate those column. Now can any body suggest me is there any method to provide Radio button instead of Check box in the grid.
-Krishnaraj
|
|
|
|
|
http://www.codeproject.com/dotnet/PrintingFormReport.asp[^]
Now I can print the form but I still have some queston, plz help!!!
Q1 If I have more than one record, how to print multi record?
Q2 If the form is too big, how to scale it in A4 width?
Q3 how to print all the lines in datagrid?
Q4 the richtextbox can not be printed, how to fix it?
By the way , if there is other method to print it like this and solve my problem, I am willing to use. Thanks!!!
|
|
|
|
|
I have the following in vCpp:
int DVP1412_CreateSDKInstence(void **pp)
this is a method in a dll, DVP1412.dll that comes with Advantech capture card.
How would I delcare this in VB.NET? What does void **p represent?
thanks
|
|
|
|
|
Any programs that can read methods in a dll and create the declaraction for a language such as VB.NET?
|
|
|
|
|
www.pinvoke.net is a good reference for win32 calls. It may or may not list your capture card's dll, but you will get some pointers about **p (which I think is a pointer)
|
|
|
|
|
"int DVP1412_CreateSDKInstence(void **pp)"
it's a "pointer to a pointer"
Theoreticaly it should come out looking something along the lines of this:
<DllImport ("DVP1412.dll", SetLastError:=True)> _
Public Shared Function DVP1412_CreateSDKInstence(ByRef pp as IntPtr) as Integer
End Function
Dim pp as IntPtr = Intptr.Zero
Dim Ret as integer = DVP1412_CreateSDKInstence(pp)
Debug.writeline("DVP1412_CreateSDKInstence: " & Err.LastDllError())
But I don't have the SDK or anymore of the code,
progload
|
|
|
|
|
When i use Dataadapter to fill datatable, if the data amount is huge, the user has to wait for a long time, so maybe they want to cancel that operation, how to do that ?
SqldataAdapter.fill(mydataset.mydatatable)
how to stop this operation
I am Entry level person
|
|
|
|
|
You can't. Since this code is most probably executing on the UI thread, you'll notice it's a blocking call and won't return execution to the next line until this query finishes. If you can't execute any code on that thread, there's no way you can click on a button, let alone make this call stop.
The only way to "stop" this call is to run the query on a background thread, freeing the UI thread to do other things. To cancel this query, all you have to do is ignore the return from the query thread. Threading is by no means an entry-level thing to put together.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i used mydataAdapter.selectcommand.cancel to cancel that operation. it returns a error which is cancelbyuser sqlexeption
I am Entry level person
|
|
|
|
|
SqlCommand.Cancel[^] docs with an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Need help on how to clear the flexgrid format... using codes...
thanks
|
|
|
|
|
Has anyone used these functions within VB.NET? I've seen several C++ samples and one VB6 but could not convert any of them to VB.NET.
Any expert advise is appreciated.
|
|
|
|