I have an application for PDAs with a long running process, and I'm getting the problem that the PDA is going to sleep before the process has completed.
I haven't got any control over the power settings on the PDA, does anyone know a good way for my application to stop the PDA from going to sleep?
I have a VB .Net service, which uses System.Threading instead of a timer to basically do what a timer should do. My problem is stopping the service while the thread is in its sleep state. See the code below:
Imports System.Threading
Public Class AService Private stopping As Boolean[code].....
If say 1 minutes after the service starts, it can not be stopped until its 15 minute interval ticks and the thread wakes. Is there any way to catch the signal that the service is attempting to stop, and interrupt the thread?
The problem that I'm encountering right now is that I can't seem to get my program to wait for a couple seconds for another application to load before it starts to check if it's open. Here's what I've got (feel free to tell me its a terrible way of writing!):
Private Sub Running_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown Main.Enabled = False
[Code]...
So if I don't have the sleep function then oasicer hasn't loaded and it says it's finished straight away, but if I call a 5s sleep then it crashes, and not for just 5 sec. Is there a replacement for this line? Something that would just delay going to the while loop?
I'm simulating some threading in a Windows Service, and the Thread.Start routine for each of my threads points directly to the following:
Private WithEvents CheckForOrdersTimer As System.Threading.Timer Private Sub timerCheckForContracts_Tick(ByVal stateInfo As Object) ' Ticks every 5 seconds, then spawns threads until we're at our max Do
[code]....
the threads aren't even doing anything yet, but with more than two threads running at the same time, my processor (Core 2 Duo 2.4 w/ 4GB) gets pegged and Windows gets really sluggish. According to what I've read, Thread.Sleep shouldn't be consuming any resources at all while it waits, but it may as well be running in a tight timing loop.
EDIT: Per the requests, I've expanded the amount of code I'm using. I was initially doing some database work before spawning each thread, but I've removed it and the processor maximization still occurs with just the code here (and, of course, the OnStart method for the Windows Service.
I'm trying to sleep a single thread of code, when i try using System.Threading.Thread, it freezes the whole app, i need it to just freeze a portion of code.
I'm simulating some threading in a Windows Service, and the Thread.Start routine for each of my threads points directly to the following:
Private WithEvents CheckForOrdersTimer As System.Threading.Timer Private Sub timerCheckForContracts_Tick(ByVal stateInfo As Object) ' Ticks every 5 seconds, then spawns threads until we're at our max
Alright, so I'm still working on the slot machine. I have three timers all independently going for my three "wheels" of the slot machine.
My issue, is that I'm trying to make a Stop button to stop each timer one at a time, and I'm not understanding why this code isn't working. The logic completely makes sense, and the first "wheel" stops when I click the button, however, it doesnt appear to stop the other two timers.
I have a simple application that use thread pool to read a file and input the data into a listbox. I want to be able to stop threadpool from running after clicking a stop button. How do I stop threadpool? Here is the code for my application below:
Imports System.Threading Public Class Form1 Private Delegate Sub StringDelegate(ByVal text As String)
I created a form and have the variable inputs for 4 motor run statements. Then with a start button the script starts and it is surrounded by a for next statement to loop 10 times. It works fine but if i need to stop the execution of the script with a stop button. I put the stop in a new section but of course does not work to do a motor stop. It just causes the exe to not respond till the loop is complete. Just need to be able to stop the Run1_Click button section.
Edit:I do not mind if it finishes the 4 motor run commands and then stops execution of the loop. So need to figure out a way to trigger a stop from a button on the form to stop the cycle. For the future the loop will be a variable integer input so 10 will not be the standard.
Edit::Does a ' Do ' statement sound like the thing to use? If so how and where would I place that? Have a Stop button on the form and it would stop after the 4th motor run command.
#End Region Declare Function InitStp Lib "stp.dll" () As Integer Declare Function RunMotor1 Lib "stp.dll" (ByVal steps As Integer, ByVal interval As Integer, ByVal direction As Integer, ByVal outputs As Integer) As Boolean
I have a START and STOP button and when the user clicks "start" the program does a whole bunch of calculations and all. However, I noticed that when I was testing the program I clicked STOP the program continues to execute stuff.
My START code is basically a while loop that iteratively does some calculations.
So I just put a boolean variable as the while condition and when user clicks stop its set to false and when user clicks start its set to true. However, when I click stop, the condition is set to false yes but it still executes all the code until the condition is re-evaluated right...so my question is how can I get out of the while loop when user instantly clicks "stop"?
I am trying to make an application with a start button and a stop button on a stop watch program. These are the codes I am using but my seconds on the stop watch don't start.
Public Form Dim intSecond As Integer = 0 Form 1 Private Dim intSecond As Integer = 0 intSecond +=1
[Code]...
After I write my code and try to run the program, the seconds will not start,
I need to record the screen when my user clicks start, and stop recording when he clicks stop.I've searched for a while on this subject, and I have found nothing.I want to do this without adding any files to my project, I just want to use some built in function in Visual Basic, and start recording, or even take a snapshot and add it to an AVI file or something...These are some sites I have found:
http:[url]......
This code is in VB6, but I am not sure how to even start using it?
Microsoft's System.io.file.exists and System.io.directory.exists can take FOREVER, especially if you're in a situation, where you've unplugged from the network and you're looking in a share.
So, to get around this, I've created a thread that times out after 3 seconds. Returning false, if the calls above haven't yet returned. To do this, my main thread passes its instance to the new thread and immediately calls:
Thread.Sleep(TimeOutInSeconds * 1000) ' Where TimeOUtInSeconds = 3 The new thread then goes and checks for the file / folder using the System.io.file.exists / System.io.directory.exists functions. Regardless of the result, then it uses the main thread's reference to call Thread.Interrupt().
My main thread doesn't get interrupted. It stays there for the full 3 seconds. If I were to change that to 3 minutes ( and I have ), it'll sleep for 3 minutes.
I have started working on a legacy project (ASP.NET 1.1) which was done in an old machine (which I dont have access to). And I am unaware of the development environment settings used for building this project.
Nonetheless, I am able to build the project and deploy it all well from my machine (I created the full development enviroment locally). In my machine everything works great.But some screens where one of the assembly dlls (third party dlls) are used do crash on any machine other than mine! They probably do net get the proper assembly (with matching version or something), even though when I have put all the assemblies in bin (and used the same files while adding references to the project). .NET runtime probably tries to find them in the GAC of the other computers? Or probably in my system itself it loads from GAC and not from the bin? How could I know all this? The question is it runs perfectly fine on my machine, where the assemblies are at both places - in bin and in GAC.
I am lost what I should do to so that no matter which machine I deploy the project, it should always look in bin only! Also, I dont want to change the code in any way because its a legacy code and has been working all right since ages! Just some settings e.g. maching.config or soemthing?
I know in the older versions of Visual Studio, there was an "Add Watch" option where you can choose to stop execution when the value of the field changed. I am using VS 2010, and I can't figure out how to hit the breakpoint when the value of the field changes.
I have read everything I can find, and understand some of it. I don't know what I am missing though. I can't get the flickering to stop. Can anyone help me? I've been using VB 2008 for months now, but I am new to the graphics bit. At first I tried using an ellipse from the powerpack, but that flickered even worse.
In vb6 I could define tab stop position as TAB(n), such that TAB(32) will put the tab stop at position 32.I could also put several tab stops in a string or write them to a text file, such asPrint #1, "This"; TAB(14); "is"; TAB(20); "a"; TAB(27); "demo"will write "This" as position 1, "is" at position 14, "a" at position 20, and "demo" at position 27.
Private Sub cmdGenerer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGenerer.Click 'Ceci remet le focus si l'age en en-dessous de 18 ou au-dessus de 65.
I would like to stop the looping. Once the name is found and the invokemember click is completed. I tried End For but it keeps looping.
For Each curElement As HtmlElement In theElementCollection Dim controlname As String = curElement.GetAttribute("name").ToString If curElement.GetAttribute("name").Equals("star") Then