|
how to code for serial port
|
|
|
|
|
Hi - hope this the right place for VB 2005 problem...
I've written a COM dll in VB 2005. I'm using the objects without problem on the machine I compile on. Using them in excel, everything great.
However, when I try to use the dll on another machine no joy at all. I have registered OK (copied from the registry on the compliation machine), the GUID's etc check out fine.
When I reference the dll (actually the .tbl file) in XL it seems to be OK. I can see the objects in the XL VB IDE, they look cool. I can step through code but when I get to an instantiation (like Set X = new MyObj) VB throws an error "ActiveX component can't be created"
??
I've checked registry, installed VB 2005 on the non-compilation machine. No joy.
After a couple of days on this need some help? Any ideas?? Could this be as assembly problem?
Distributing a dll in c++ was never this painful (once it ciomplied ... )!
cheers for the input
gazza
|
|
|
|
|
Did you register the assembly using RegAsm or did you just try to copy the keys yourself?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thks
I tried using RegAsm with 2 variants on the command line
RegAsm mydll.dll
and with the /tbl option
RegAsm mydll.dll /tbl:Mydll.tbl
I haven't got the error messages to hand but didn't work.
On the key question, I exported them to a .reg file on the compiling machine and re-imported on the new machine. The key *looks* to be OK.
there is a chapter on assemblies in Balena that I have started to go through but nothing useful yet.
thks for your reply.
|
|
|
|
|
Well, the other problem could be that your library code isn't decorated with COM attributes properly or completely.
You really DON'T want to just export the registry key and import it on another machine, there's definitly more than one key that has to be created!
Also, when you use RegAsm, if you don't use the CodeBase switch, you MUST either put your .DLL in the same folder as the .EXE client app that's using your COM objects, or you must install it into the GAC, but your assembly has to have a strong name to do that. If you don't, you can get the error that you're talking about.
If you use the CodeBase switch, you can register the .DLL where you want to put it, so long as it doesn't move after the registration is done.
C:\My Folder> REGASM MyComAssembly.dll /tbl:MyComAssembly.tlb /CodeBase
When I'm creating an assembly I want to expose to COM, this[^] is the step-by-step sheet I follow.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thks
I am running .NET 2.0.50727
1. was using RegAsm ver 1.?? previously. Now using ver 2.0.50727.42 and I can register - I have done this now as indicated with the /tbl & /codebase as indicated on 2 machines with success.
Recall I am trying to use the objects in excel(.exe) through the VBA interface.
I find:
1. If I regsiter in an arbitrary directory on a client machine some interesting effects. When i try and instantiate I get "run-time error '-2147024894 (8007002)' File or assembly name "MyClass", or one of its dependencies, was not found"
2. If I regsiter in the excel.exe directory on a client machine, i try and instantiate I get
"run-time error '-2146234105 (80131107)' The format of the file "MyClass" is invalid.
had a sniff around, these errors have been seen before but I haven't found a solution to them.
In an attempt to "back-engineer" I have built some simple classes on a non-local machine (a machine that throw errors when I try and use classes from my local machine)... and after registration they work perfectly (!) on my local machine. Interestingly classes I build on the non-local machine do not function of the excel version of the non-local machine.
So although not solved some progress. Going to check Excel versions across machines and that .NET frameworks are consistent.
cheers
|
|
|
|
|
LittleEd wrote: o although not solved some progress. Going to check Excel versions across machines and that .NET frameworks are consistent.
My next two suggestions!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
OK think we are there ...
Client machines were looking to run (& debug) using a V1 release under NET. It was quite a pain finding how to amend this setting.
Tried editing the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AD7Metrics\Engine\{449EC4CC-30D2-4032-9256-EE18EB41B62B}
and adding & setting this entry:
CLRVersionForDebugging=V2.0.50727
..with no effect.
Stumbled upon a solution: edit (or create if necessary) excel.config.exe.xml file to look like
<configuration>
<startup>
<supportedruntime version="v2.0.50727">
<requiredruntime version="v2.0.50727">
& I placed a copy in the same dir as the excel.exe file. All COM classes now available, debugger works fine etc.
Should be *careful* on backward compatability issues but that's not a concern for me.
thanks for your interest,
GH
|
|
|
|
|
I should have added that i've tried to register the type library itself - the code ran fine but the still app didn't let me instantiate objects
the code I used was in the spirit of the link below
http://www.devx.com/vb2themax/Tip/18443
|
|
|
|
|
OK, there doesn't seem to be a concise definition of this anywhere, particularly on MS's pathetic excuse for help.
With the Mod operator, I've always thought that it return everything after the decimal point. Eg,
12 / 5 = 2.4
Therefore I'd expect
12 Mod 5 = 4
In practice, the result seems to be a random number, dependant on the current temparature in Kelvin, the number of times you have double clicked in the last six seconds and a random number between 12 and 47. From some testing...
12 Mod 5 = 2 ??
In fact, from the source code on MSDN, they say that
10 Mod 3 = 1
All I really need it for is working out if a Byte is even or not. If anyone can dare to explain, I'm sure it'll be useful.
Yet another spam post on yet another forum!
I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to.
I love being a student.
|
|
|
|
|
MOD Returns the remainder left over after the first number is divided by the second number
12/5 is 2 with a remainder of 2 Therefore 12 MOD 5 is 2
10/3 is 3 with a remainder of 1 Therefore 10 MOD 3 is 1
and so forth.
Don
|
|
|
|
|
So it's the actual difference...dang. Been thinking in decimal too long. Well that was clever - especially since it's only taken me 3 years to notice...
Ooo...this could have new uses.
Thanks muchly.
Yet another spam post on yet another forum!
I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to.
I love being a student.
|
|
|
|
|
Yuppers such as a quick and dirty way to check to see if the current minute is a multiple of 5 without all the fancy if minute/5 = int(minute/5) and so forth. Use it for all sorts of cool stuff.
Glad to be of help...
|
|
|
|
|
|
Hey out there,
I have a Sequential workflow I have written and published as a web service. I need to implement tracking for the workflow. However, every example I have found shows hosting the workflow inside another ASPNet application. I have tried multiple iterations and variations on this theme and nothing seems to work correctly. I don't get any faults running the WF, however, Microsofts "WorkflowMonitor" sample app crashes with a "GetWorkflow" error every time I fire up the workflow. I then have to MANUALLY clean up the tracking database before it will run properly again.
Does anyone out ther have a SIMPLE VB.Net based example of doing this?
Thanks,
Don Trainer
|
|
|
|
|
Hi to all,
I have create a little client to test a webservice called EuroCv.eu
The problem is the connection and the time of the connection to the server. I need to create a simple progressbar to show the progress of the request to the server.
Is it possible?
Thanks
|
|
|
|
|
Hello!
I would like to know how can I check the following listed below in runtime: I need these before user runs the application.
a. If a keyboard exists in puter
b. If a mouse exists in puter
c. What is the current screen resolution
d. What is the total available memory
3. Operating System (addressing numeric values)
Thank you.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
You can access the last three in my.computer but the first two i'm not sure.
Posted by The ANZAC
|
|
|
|
|
Hello,
VS 2005.
I have created a typed dataset. I have dragged some tables from the server explorer on to the designer.
However, one of my tables it doesn't auto generate the update and delete statements. I have tried configuring the table adapter. I have clicked the advanced options and checked all 3 options. And on methods to generate I have checked all 3 options again. I click next and it will tell you what statement it will generate, but the delete and update are not included.
Also, when I use this in code for finding by the primary key, it doesn't have a method for it.
i.e
<br />
datarow = me.dataset.software.findBySerialID(serialID)<br />
The method FindBySerialID doesn't exist.
Does anyone know why this is happening.
Thanks in advance,
Steve
|
|
|
|
|
Hi.,
How to call a webservice using javascript in vb.net, inline code using Ajax. I am using Atals, i have two textbox, first text box is autocomplete, autocomplete done using ajax, after the first text box is filled, the second text box should be filled depending on the first text box values.
Please guide me with examples.
Thanks and Regards
Shyam
|
|
|
|
|
This is a question better suited for the ASP.NET or Web Development forums.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am posting the same problem 2nd time. Sorry for that but the strange thing is happening in the function. It suppose to display a message but it is giving me "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object." error message. It loads the file there in no problem. Either keys and values exist in the file also. The message boxes display nothing. What is causing the problem? Thank you. Here is my code:
The file is under application.startuppath /bin/debug directory
Private Function GetCnfgParameter(ByVal MyKey As String) As String
Dim DocXml As New XmlDocument
Dim NodeXml As XmlNode = Nothing
DocXml.Load(Path.Combine(Application.StartupPath, "app.xml"))
NodeXml = DocXml.DocumentElement.SelectSingleNode("//configuration/AppDefaultValues/add[@key=""" & MyKey & """]")
If TypeName(NodeXml.Attributes.GetNamedItem("value")) <> "Nothing" Then
NodeXml = NodeXml.Attributes.GetNamedItem("value")
MsgBox(NodeXml.Value)
Else
'No @ mykey attribute in attributes collection
MsgBox("Could not find the @mykey attribute as in a <add mykey=''> element.")
End If
Return NodeXml.Attributes.GetNamedItem("value").Value
NodeXml = Nothing
End Function
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
JUNEYT wrote: NodeXml = DocXml.DocumentElement.SelectSingleNode("//configuration/AppDefaultValues/add[@key=""" & MyKey & """]")
This line is prone to "Object reference not set to an instance of an object" error. You will have to check whether NodeXml is nothing before using it further.
JUNEYT wrote: TypeName
What is this used for ? and what does it returns ?
JUNEYT wrote: <> "Nothing"
If you are trying to compare returned value for nothing / null then you will have to write -
not ({expression} is nothing)
or
not ({expression} = nothing)
Use the 'is' keyword if the return of the {expression} is a reference type else use '='
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Thank you very much I solved the problem. The back slash was causing it.
cheers!
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Also,
I got two Table Name Volume and VolumeLessons .
I have used a Query to make a SingleTable name Query_Volume_VolumeLessons, now this table is inside my code or Prject not in SQL SERVER DataBase.
Now I need to pull data from Query_Volume_VolumeLessons to make another two table name Query_Volume_Sector and Query_Volume_Themes for further work and then lots of thing....................
Please help me
Sarfarj Ahmed
|
|
|
|