thanks for reply.
our organization are shifting from an older version of third party API to its latest version. and we want to make this transition smooth, we want to use both for a while and gradually replace the functionality from older version to new version. if you have any alternative solution then please share.
also, i've found that in SharpDevelop you could simple select the reference in the solution explorer, click properties and set a alias, this works for VB and C#, i can't verify that this is true for visual studio (i don't have it here), but its a good start point
if nothing works, the solution is to create 2 more class library projects and warp each version in a diferent namespace... too much work
EDIT: i haven't managed to reference the alias defined in SharpDevelop into the code, so, i think you will be forced to warp the dlls...
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
So I am currently attempting to wrap my head around create multi-threaded programs and I am currently running into an issue when using a Shared variable across multiple threads.
The program is structured as follows:
Public Shared IsActive as Boolean
Main Thread = GUI
Sets the Value of IsActive through a Button Control
Two Worker Threads
Both threads are while loops that read the IsActive Boolean
While IsActive = True
However when I change the value of IsActive from the Main Thread it causes the worker threads to stop (ThreadState = 16).
I have been reading that I have to synchronize/lock shared resources and have tried SyncLock and Monitor methods without success (it is entirely possible I am not using the above correctly, so If someone could provide proper examples for the above situation using the mentioned methods please share them).
Thanks a bunch for any and all help, much appreciated!
If I read your post correctly, you declare a variable in your UI code (isActive) and set it to True. Then you start two threads that both look at isActive and run until isActive if False. When you set isActive to False, both threads stop.
This is the expected behavior. Or am I missing something? What are you expecting to happen?
See, that is what you get from a poor choice of an identifier name, what you have implemented is a "PleaseContinue" flag: as soon as you set it false, the worker threads have nothing left to do, and terminate.
If OTOH you want a "TemporarilySuspended" flag (I switched polarity here!), something you could set true and false repetitively and your worker threads would obey, then you need your worker threads to wait for it to become true again. An AutoResetEvent may be a good choice then.
Anyway, IsActive is a bad name, as it does not describe a state, it is intended to give a command.
Yes correct, in my initial post I realize that the threads were behaving exactly as they should and just ended when the variable broke the workers out of the Wloop.
Basically, I want the two workers threads to constantly be running, and then when the shared variable is set to true they then start doing work. Then when the user clicks the button again the worker threads "pause" and wait for the next time the variable is set to True.
The "IsActive" name was just an abstraction. I use a much more detailed name in my actual code.
In regard to the "TemporarilySuspended" flag and AutoResetEvent, could you provide some examples, would love to handle that properly.
I'm may throw up because I'm supporting a V6 user, but you have to dig out the manual on the printer and get the character sequence to send to the printer to tell it to cut the receipt. Then you modify your code to send that character sequence when your receipt printing code is done.
.NET cannot target building a true ActiveX component. You've built a COM-exposed library. I have no idea if Smart Install Maker handles .NET assemblies properly and regsiters them. You'll have to contact the people that make Smart Install Maker for that.
Hi all, Hope someone can help with this...
I wrote this code several years ago and it has worked great in XP. Our department is rolling out Windows 7 and the agency that uses the app I wrote are finally receiving their new Windows 7 systems.
One problem... code doesn't work any longer.
The code sets up a DSN entry on the fly. In XP, a standard user without any elevated rights could run the app and this code worked.
Now in Windows 7 when installing, I have the end user setup as local administrator and the app fails to Create the DSN. If I go in and right click on the "Click-Once" setup.exe and select "Run as administrator" it works. Also if I create a shortcut to the setup.exe and change the advanced settings to "Run as administrator" it also works from that shortcut.
If I use the icon created by the program from the "Start" menu or from the desktop, which doesn't have an option to "Run as administrator", even though the client is setup as local administrator, it kicks an error that it can't create the DSN. I can delete the DSN and see when it is created and when it can't and it coincides with the trials I've listed above.
Is there something I can put in code that allows it to work no matter if administrator or if a standard user, like it did in XP? Some google posts talk about UAC causing the problem, but just say they recommend to run as administrator.
I've searched google and code project, and most articles / posts seem to be from 2004 or around that time. We're using VS 2010... Is there a better way to creat the DSN's on the fly with VS 2010?
Here is the code
Public Declare Auto Function SQLConfigDataSource Lib "ODBCCP32.DLL" _<br />
(ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer<br />
Private Const ODBC_ADD_SYS_DSN As Integer = 4<br />
Friend Shared Sub Create_DSN_For_Crystal_Reports()<br />
Dim attributes As New System.Text.StringBuilder()<br />
Dim returnCode As Integer<br />
attributes.Append("Description=DSN added via code from Beneficiary System")<br />
returnCode = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, "SQL Server", attributes.ToString)<br />
If returnCode <> 1 Then<br />
Throw New Exception("DSN could not be setup to allow Crystal Reports access - Contact Programming Staff")<br />
End If<br />
Catch ... <br />
End Try<br />
End Sub<br />
Lost in the vast sea of .NET
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-23 11:58