Im using the express edition of VB.Net to do my project. I have several threads in my program which run fine. However, im stuck at this problem. I have a button in my form, which if I click I will call ThreadA (works fine), If i keep it pressed for more than 2 sec i need to call ThreadB (doesnt work), and if the time is more than 2 min, i need to stop and send a msg to the user. I have tried the timer to calculate the elapsed time, so the tick function would call the thread. BUT this doesnt work... Im not sure what do to.
I'm creating a multi-threaded application (although it is not at the moment) which will be connecting to a large number of sockets. I've noticed when a connection cannot be made the connect timeout is rather large, so I am trying to make my own. Here is what I have come up with...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CreateSockets(2) AssignSockets(0, "192.168.31.2", 80, False, False) 'shouldn't connect AssignSockets(1, "192.168.1.1", 80, False, False) 'should connect
[code]....
Looking at the timeoutOccured() sub, you can see I'm unsure of how to specify which index to set. Efficiency is important since this will be housing a lot of connections at once. Something else that just came to mind, would .theTimer.Stop reset the tick value on the timer?
I am using timers in a windows service and facing problem that anytime some exception happens ( say i unplug LAN wire from my computer ) service stops running, What i am expecting is that service should keep on running as i am catching generic exception which should catch the exception on one tick event and again work (next tick)when i plug in LAN wire (i am plugging/un plugging ) LAN wire as this service is reading database from LAN so i want to replicate a failover scneario)
I've got my serial/com port code working ok using the standard Port.DataReceived handler:
AddHandler Port.DataReceived, AddressOf port_DataReceived I now want to be able to handle multiple COM ports. Do I have to create multiple copies of the handler sub or is there a way the handler sub can tell which COM port it was called for?
How can I incorporate the timer so once a page loads the timer activates, waits a few seconds then I tell my program what to do next.I tried this code but it didnt work:
I am trying to block a list of processes from Txt file/ Listbox System.Diagnostic.Process using Timer. Here's the timer codes
[Code]...
I can block processes from the list using SelectedItem, but it doesn't block all the process in the list.Using while loop causes a deadlock error here. I'm now using aBlock.ReadLine to read from txt file and block the available process. However it is only able to block the first process. Need some guidance to get this code to block all the processes in the list.
this is my very first posting and I must say I am desperate. I have a VB assignment due in 2 days and I am so lost. I have written a code to draw some graphic, just a basic house, tree, sun etc. I have also written a code to magnify said graphics which were all the specifications of my Assignment 1 part A. Now for Part B I am being asked to extend my program so that: A - My graphic can be drawn using different colour schemes designed by me but chosen by the user B - My graphic or an appropriate part of it can be animated around the picture box if the user chooses to do so. C - Error checking is included.
I'm trying to make a form that will read my wordlist. txt (one word or phrase per line) then using a timer, insert one word randomly selected from the list, and display it in textbox1 where it will remain until another timer changes the word. The word in the textbox will display for a random time 1min to 7 min, then the textbox displays another word randomly selected from the word list.
I am trying to calculate a total cost from an elapsed time. Dependant on how long the time is, this will calculate the total cost. It has to be 3 to every hour. The elapsed time is displayed in label6 in "hh:MM:ss" format and the total cost needs to be displayed in label8.
I have VS 2008 and wow is it different from the old VB I used about 10 yrs ago! What I am trying to learn is how to create an ap that has a window that displays elapsed time like a stopwatch. Then I would like to be able to click a button to pause that time and start another timer, and then have yet another button to reset all. I have the form designed using a RichTextBox but am not sure that is the best way to display the times.
I have one text box that contains a value for the "Start Time" and another text box that contains a value for the "End Time."Both of the values are expressed in a format for military time (i.e. 1200, 1300, 1430, etc.).When the "End Time" text box loses focus, I would like the "Elasped Time" (expressed in minutes) to appear in a third text box.Seems easy enough...right?Well the problem I'm having is since the first two numbers in military time are base 24 and the last two numbers are base 60, a standard calculation subtracting the "End Time" from the "Start Time" does not yield an accurate result.
I am using a stop watch to get the elapsed minutes and seconds which will then be displayed to user. How to I go about getting the elapsed time in the following format: 00:00
display a Decimal (or double) to elapsed time [h]:mm:ss (hours:minutes:seconds)using vb.net?
example:
if you were to type "1.34666666666667" into a cell in Excel then choose Custom Format [h]:mm:ss The result is an elapsed time of "32:19:12". Using the OADate function only runs on a 24 hour clock so this does not work for longer durations unfortunately...
Bit stuck on this one, have seen alot about how to do it just cant seem to get it right. I want to have 2 text boxes with times in them.. at the moment i have them on click events then it just runs a Now for the time and fills the boxes from the system time. But then i want the 3rd box to find the elapsed time from the 2 times in the previous boxes but i just cant seem to figure it out
Bit stuck on this one, have seen alot about how to do it just cant seem to get it right.I want to have 2 text boxes with times in them.. at the moment i have them on click events then it just runs a Now for the time and fills the boxes from the system time.But then i want the 3rd box to find the elapsed time from the 2 times in the previous boxes but i just cant seem to figure it out
I require the Login button on the User app to be enabled at a certain time during the day, and the Admin will specify the time. How do I go about achieving this? I have a database as wellDo I save the time in the Database that the Admin enters, and then retrieve the time from the database when the User app is running and compare the clock time on the User app to the time from the database (I will retrieve the time when the User app starts)
I have a sub routine that connects to a database. If the database is unavailable it takes about 45 seconds to timeout, even though I used connect timeout=10 in the connection string.
So I figured I would try using a timer. This is how I have it Private Sub SQLConn() Timer.start() SQL.Open() Timer.stop() Private Sub Timer2_Tick (this is where I need to put a command to stop the sub SQLConn)
I have the timer set at 10 seconds. Unless there is a better way to do this what command can I use to stop the connection or the sub?
I built a game, that's a basic soccer game. You stop a trackbar, and if it's in the middle then it makes a goal, if not the you lose. I want to up the ante and build my version of brick breaker. I have a bonus timer where if you finish the level within the time frame then you get bonus. When my menustrip is visible then the game pauses. Here's what I got so far:
I have a very simple StopWatch application in Silverlight. I have the following private properties in my MainPage class: _StopPressed (bool), _TimeStart, _Elapsed (string). I also have a "Start" and "Stop" button. The "Start" button calls a method called UpdateTime that constantly updates _ElapsedTime until _StopPressed is true. When I originally wrote it, UpdateTime would block the UI so I couldn't press the Stop button, so I updated my code to use System.Threading.ThreadPool.QueueUserWorkItem with my UpdateTime method so that it updates _Elapsed on a background thread. That works great at updating the value.However, if I try to set the .Text value of my TextBlock from within UpdateTime(), I get an UnauthorizedAccessException that has to do with one thread accessing the data in another thread.What do I need to do to avoid getting this exception and appropriately update the UI without blocking it?
I am trying to write a program to count the total seconds while the user is active (moving his mouse".. I have the following code
' Get the mouse's current position and see if it has moved since last time. private Sub mrCheckMouse_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles tmrCheckMouse.Tick Static done_before As Boolean Static last_point As POINTAPI Dim cur_point As POINTAPI
' If we have done this before, compare the ' current mouse position to the previous one.