|
it was my mistake........apologies from my side ....
|
|
|
|
|
hello,
can i some how sleep a process in an application?:
my problem is i want to execute a sql string.
if it failed i want wait some (milli)seconds before i repeat the execution
thank you
|
|
|
|
|
Hi,
use a sleep(x); in your function
Regards
|
|
|
|
|
but where can i find it?!
|
|
|
|
|
Call
Thread.Sleep(1000); to sleep for one second. Yet, if you do this in your main Thread, this will cause your UI to freeze.
Regards
|
|
|
|
|
hi!
use
Thread.Sleep(5000); // this will sleep the thread for 5 seconds
abhinav
|
|
|
|
|
yes, thank you.
thats it.
|
|
|
|
|
how do you create a control array in C#?
|
|
|
|
|
Control[] MyArray = new Control[X];
Was that what you were looking for?
Regards
|
|
|
|
|
I'm quite new to c#. Can smbody pls tell me how to connect a mysql database to a c# project? Thanks
|
|
|
|
|
|
you need to install an ADO.NET driver for mysql, you can find one here:
http://dev.mysql.com/downloads/connector/net/5.0.html[^]
Once installed, new components, like MysqlDataset and MysqlDataTable, will appear in your toolbox in visual studio. Documentation on how to use them should also be included in the download, otherwise you can lookup the documentation for the ADO.NET components, like Dataset and DataTable, in the visual studio documentation, they are used the same way.
|
|
|
|
|
Hi,
are there any roules for a dll written in C#, which can be called by a VBA Macro?
Private Declare Function foo Lib "foo.dll" (sfoo as string) as string
How does the C# code for such dll look like?
Ariadne
|
|
|
|
|
Hi!
You'll have to create a COM object for this, VBA cannot access a function in a .NET assembly.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
What Mav said is true. But as an addition, you can write your code as C# and make your C# dll, then register it as COM dll then use it from your VBA macro.
I think this post[^] would be helpful.
Regards
|
|
|
|
|
Really?
Is it complicate to register a dll as com?
Ariadne
|
|
|
|
|
Well, not really. You can follow the link to the post I gave you in the previous reply.
Here is the link again[^].
Regards
|
|
|
|
|
you should check : ServicedComponent
|
|
|
|
|
Thanks.
If I use tlbexp I get only my class exposed, but not my methods. Any ideas? (I suppose, the methods have to have a certain format.)
Nevertheless I do not belive, that a COM-object is the only way to get a connection to VBA. With a COM-object you do not need a Declare Function statement. But with a Declare Function one can access all routines eg. in the kernel.dll. (And that are not COM's in kernel.dll).
Ariadne
|
|
|
|
|
If you got your class exposed, how come not the methods in it?? Aren't they public?
If there is some sort of a VBA .Net language then this would be a solution to your problem, bur otherwise there is no other direct conection between umanaged-to-managed code that I know of.
Regards
|
|
|
|
|
public class PW
{
public static string Convert5Bit(byte[] abytID)
{
return sConv;
}
}
This is the declaration. But only PW as class is exposed.
-- modified at 5:19 Thursday 26th October, 2006
Ariadne
|
|
|
|
|
First:
Post your question to my answers, not to your question. I only saw your question by chance.
Second:
Try to reference to your new COM object in a C++ or C# project and see what is/isn't exposed
Third:
If none other works -I'm not that expert in VBA so if applicable- Make your method non-static, and call it form an instance of the class rather than the calss itself.
Ps.
BTW, what way did you know by it's not exposed?
Regards
|
|
|
|
|
thanks for 1st.
2nd I look into the code with notepad and try in VBA the Object-Browser. both show only PW and not Convert5Bit()
3rd it tried that, but no success.
thanks for your ansers!
Ariadne
|
|
|
|
|
Ariadne wrote: Object-Browser. both show only PW and not Convert5Bit()
Well, in that object browser the method should be under the class name, shouldn't it? I mean you access the method by the class name? Also what file did you look into using the notepad?
Ariadne wrote: 3rd it tried that, but no success.
Define "no success"? You can't instantiate the object from the exposed class? Or the instance can't access the member function?
Regards
|
|
|
|
|
Nader Elshehabi wrote: Also what file did you look into using the notepad?
I opened the tlb-File with notepad: There was no Convert5Bit.
Nader Elshehabi wrote: object browser the method should be under the class name
Under the class name is no method.
If I instantiate the class I get an runtime error: 429 ActiveX component can't create object.
But VBA knows the class PW.
Ariadne
|
|
|
|