473,787 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System Threads and system Timers oh joy... [.net]

3 New Member
Expand|Select|Wrap|Line Numbers
  1. Sub FindOpenThread()
  2.         Try
  3.             Dim DS As Integer
  4.             Dim mWorking As Boolean = False
  5.  
  6.             If tCount = 0 Then
  7.                 tCount += 1
  8.                 mThread(tCount) = New Thread(AddressOf ScanNow)
  9.                 mThread(tCount).IsBackground = True
  10.                 mThread(tCount).Start()
  11.                 Exit Sub
  12.             End If
  13.  
  14.             For DS = 1 To tCount
  15.  
  16.  
  17.                 If (mThread(DS) Is Nothing) Then GoTo LMF
  18.  
  19.                 If mThread(DS).IsAlive = False Then
  20.  
  21.                     mThread(DS) = New Thread(AddressOf ScanNow)
  22.                     mThread(DS).IsBackground = True
  23.                     ATO(DS) = 1
  24.                     mThread(DS).Start()
  25.  
  26.                     Exit Sub
  27.                 Else
  28.                     ATO(DS) += 1
  29.                 End If
  30.  
  31.             Next
  32.  
  33.  
  34.             If tCount >= CInt(nud1.Value) Then
  35.                 Exit Sub
  36.             End If
  37. LMF:
  38.             tCount += 1
  39.             mThread(tCount) = New Thread(AddressOf ScanNow)
  40.             mThread(tCount).IsBackground = True
  41.             mThread(tCount).Start()
  42.  
  43.         Catch ex As Exception
  44.             Debug.Print(ex.Message)
  45.             Debug.Print(ex.StackTrace.ToString)
  46.         End Try
  47.  
  48.     End Sub
online 25 or so the .start i get the error [Thread is running or terminated; it cannot restart.]

breaking it, the thread shows .isalive=true but it still enters in the section of code.

and either way though....with it dimmed in the top like
Expand|Select|Wrap|Line Numbers
  1. Dim mThread(25) As Thread
and using my code like...
Expand|Select|Wrap|Line Numbers
  1. mThread(DS) = New Thread(AddressOf ScanNow)
  2. mThread(DS).IsBackground = True
  3. mThread(DS).Start()

shouldnt the dang thing just recreate it?


any help here? btw this is being called by a system.timer event
Aug 30 '11 #1
0 840

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2738
by: Bern McCarty | last post by:
I'm trying to use the VS 2005 March Tech Preview and am trying to adjust some MC++ to the new C++/CLI syntax. I got a little hung up when I encountered the below error. Certainly my 'Bentley::Mstn::Element' type derives ultimately from System::Object. It is a ref class. And upcasting is always implicit right? So I don't understand why I'm getting this error. It's happening on my get method: property Bentley::Mstn::Element^ Item {...
8
1365
by: Angel | last post by:
Hi everybody, I am new to ASP.NET, and my question might be obvious to most of you but I do not seem to find many things about threads and ASP.NET. I have an object(Object 1) which need some service from another object(Object2). Object 2 has only two methods and no members. Load(Object1 obj, int id); Save(Object1 obj);
7
3111
by: Syed Zeeshan Haider | last post by:
Hello Experts, A friend of mine is trying to install VB.NET on WinXP 2002 SP1 but the installation wizard is asking for WindowsNT based system. What are the system requirements for VB.NET? Can't it be installed on a WinXP computer? Thank you, -- Syed Zeeshan Haider. http://szh.20m.com/
13
1676
by: John T. Howard | last post by:
How can I get the System Information via vb.net? At a minimum, I need that data supplied in Start|All Programs|Accessories|System Tools|System Information and, preferably the Office Applications subheader. Thanks in advance, John
1
992
by: Nikolay Petrov | last post by:
Can I use threads ih ASP.NET page? I one to run a long operation in separate thread and from it to update a control in aps page to display status information. Is this possible? My first guess is not, but worth asking. TIA
3
4064
by: Chris Thunell | last post by:
Is there any way to programmatically create an odbc system dsn in vb.net? I have a bunch of DSNs that need to be created for SQL, Access, and Timberline and i thought that it would make my life easier if i had a little program that would run to create these DSNs instead of manually installing them on each pc. I'm lazy - what can i say! :) The ODBC drivers are already installed, i just need to create specific DSNs. Any thoughts?...
4
7766
by: TheJediMessiah | last post by:
Hi, I have a number of objects for which I want to create a timer for. So for each object I would like to have a timer which runs at a different interval. For a single timer I know how to implement timer = new System.Windows.Forms.Timer(); timer.Tick += new EventHandler(Timer_Tick);
1
1641
Parul Bagadia
by: Parul Bagadia | last post by:
Why do we have 2 differnt things in windows as; system and system 32? which all files differ in these things and why? Am searching on google but if someone know in advance i can utilize my time....... so don't mind answerin this :-)..... thanks in advance..
9
7641
by: PRR | last post by:
Use a System.Timers.Timer. You can call a function on elapsed event. In the service on start method, enable the timer. Timer(MSDN): "The Timer component is a server-based timer, which allows you to specify a recurring interval at which the Elapsed event is raised in your application. You can then handle this event to provide regular processing. For example, suppose you have a critical server that must be kept running 24 hours a day, 7 days...
3
2040
by: Sopheap Panha | last post by:
Could you give me the color and color name in System.Drawing.Color of .NET Framework? thank for helping.
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.