Three Classes Running As Separate Threads?

Nov 21, 2006

I want to have three classes running three simoultaineous threads. I have started out with one class that looks like this:

Imports System.ThreadingPublic Class C_EventCollector Dim oThread As Thread Public Sub New() oThread = New Thread(AddressOf Me.BackgroundProcess) End Sub Private Sub BackgroundProcess() Console.WriteLine(Now.ToString) oThread.Sleep(10000) End SubEnd Class

What I want is execute BackgroundProcess() every tenth second. For testing purpose I print out current date and time to the console. Using this thread BackgroundProcess() only executes once.

View 1 Replies


ADVERTISEMENT

Use Threading In Application To Put Two Functionality In Two Separate Threads?

May 2, 2009

I have one applicatin developed in my ap i have two main functionalities

1)Copyig Folders & Files from one source to destination

2) And I am showing status of copying in richtextbox and progrss with progress bar

Here i need to use threading bcz i am copying files from one server to another server and some large size files while copying my application always gone to stuck and i am not able to see status of copying and progressbar so how i use threading in my applicatio to put two functionalitis in two seperate threads.

View 4 Replies

Accessing Classes In A Separate Project

Dec 6, 2010

I have coded two seperate VB.net windows forms application as two seperate projects in seperate solutions. I now want to combine one project called "Reporting" into the other project called "AnalysisApp" and be able to call the Reporting apps main form.The Reporting app utilies a whole load of controls from DevExpress which are not included in the "AnalysisApp" I have added references in "AnalysisApp" to the DevEpress controls and also to the Reporting app, as well as combining the Reporting app into the same solution, but when I build the "AnalysisApp" it fails saying that it cannot find the DevExpress DLLs

View 3 Replies

ASP.Net - Accessing Controls From Separate Classes?

Jun 23, 2010

I have an ASP.NET Web Site I am creating in Visual Web Developer 2008 Express using Visual Basic as the language. It is actually a rewrite-with-mods of an existing ASP script and I'm trying to chew what I've bitten off. I created my page with a text box (txtOutput) on it and since the end product is very complex, and it's generally good practice to separate like functions, I have created 4 separate classes in the App_Code section. My main page is Sync.aspx and has a code file Sync.aspx.vb with it. One of my code files is SyncDatabases.vb and in it I have created

Public Class SyncDB

In that class I have created some routines such as

Public Function ReadMSDB(ByVal SQLString as string) as Boolean

In this routine I want to put information in my text box txtOutput on the main form (the default - Form1).

My problem is that if I try:

Form1.txtOutput.Text = "Hello world"

or just

txtOutput.Text = "Hello world"

it says Name 'Form1' (or 'txtOutput') is not declared. I am sure I am missing something simple but have no clue what it is. I assume it's the fact that the write command is in a file (class?) outside the file (class?) containing the page itself but I don't know how to address it properly.

View 4 Replies

Storing Classes In Separate Files?

Mar 18, 2012

In Java you can store a class in a separate file and instantiate it from a method in another file as long as the class file is in the same directory but this doesn't seem to work in Visual Basic.

View 1 Replies

Create Separate Classes For The Timesheets And Invoices?

Oct 19, 2010

I have a class called FileInfo. It has properties for stuff like FileNumber, Vessel, OpenedDate etc.

Now for a file I need to have Timesheets and Invoices.

My question is, do I create seperate classes for the Timesheets and Invoices?

View 5 Replies

Forms :: Multi Threading With Separate Classes

May 7, 2011

I'm trying to dive into what I consider a deeper end of VB.net to see how far I can go with it. I have a project created, ironically called "My First Server". The aim of this is to create a server which can handle multi clients but additionally isn't the commonly shown tutorial setup of a console application. So it is created as a Windows Form application. The main form (Public Class PrimaryForm) consists of only one control which is a listbox control. This is named LogOutput.

[Code]....

View 7 Replies

Running All Threads Not On The GUI Thread?

Dec 7, 2011

I have only managed to use an STA to run a long running excel process with a background worker and 2 delegates.

What I want to do now is have the whole application running outside of the main thread to make sure the UI is always available, I then want to create new threads from the thread I have outside of the main to run the various processes. I will need to have some form of syncronisation in there for certain things to be done once a thread is completed and also I will need to change the button states on the main form to stop certain process being called whilst other processes are running.

This is my code so far, basically this loads in a csv file to a datatable adding manager employee ID and email address, filters it and displays the resultant data in a listview. There eventually will be some filter options as well. There are then 2 options for processing the data, it will produce individual bradford factor reports and email them to each manager or will produce a summary spreadsheet that is sent to HR.

Currently because there are around 8000 lines of data, it was the summary option that required the background worker as a long running process time out error was occuring whilst in the main.

What it does is write the data from the list view to an excel sheet and colour co-ordinates the summary rows according to the absense policy. It then copied bottom to top, the summary value the next blank column against all the lines for that individual and then uses this column to decide which sheet to move the row to, copying the row to the new sheet then deleting it from the master list and shifting the cells up.


This works well, but the process of loading the data in to the list view locks up the main thread where it currently runs. I also wanted to make this slightly more complicate as far as threading is concerned, as more of a learning curve than a practical application of the function.

Here is my code so far: [URL]

View 10 Replies

Forms Running In The Same Application But On Different Threads?

Dec 9, 2009

I have two forms running in the same application but on different threads. HdForm and DataForm. I have a class library whit datasets and a stack in it. Cause both forms (different threads try to rad from the same class library i use a synclock to syncronize. But it seems like the synclock dont work.I get random errors in the HdForm while reading from myAr dataset. It says index out of range. But i know for sure that the index exist (i have make sure of that). When i click on the visual studio play button then, it goes again.If the index was realy out of range then it couldn't go further. So i think the synclock does not work and thus the dataset is changed in time while im the loop reading from MyAr.

[Code]...

View 3 Replies

.net 2.0 Multiple Programs Each Running Threads On Xp, Will .net 2010 Be Better?

Oct 2, 2010

In the past few weeks, to speed up our database freshening process, I've created a couple of extra programs, basically copies of the exe file. The program itself, accesses web pages, images etc and uses threads to do so. The second program uses LIMIT 300,100 and the third LIMIT 600,100, to make sure they don't work on the same records.

Before the last few weeks, one occurrence of the program used to run without problem, from the task scheduler all through the day. Only one occurrence of each exe can run at a time.Since theres now three programs running, .net 2.0, on xp, the program often seems to get stuck and never ends. I have to kill it from task manager.

It runs fine in the IDE I just wonder if there would be any benefit from upgrading to vb.net 2010 ?

View 1 Replies

Multithreading - Code For Running Multiple Threads?

Apr 17, 2010

How to I run multiple threads in VB.NET? Say I need 2 threads - one that prints 100 numbers in a loop and the second one that asks for the user's name and prints it inside a message box.

View 1 Replies

Running Different Processes In Multiple Threads Without Overlapping

Jan 13, 2012

I have a sub-procedure which I want to run a different process, depending on what is currently running. I thought the easiest way to do this was by using an ArrayList of each of the campaign details & adding an 'Inuse' field to check to see if the Inuse field is set to 0 or 1. The problem that I have is that when running the process it is all happening at once & the integer hasn't been changed before the next thread kicks in so my threads are running the same campaigns. I tried to avoid the problem by adding a Thread.Sleep(100) delay inbetween starting threads but this led to exactly the same problem.

Here's an example of what I am trying to do:
Imports System.Threading
Public Class Form1
Private Campaigns As New ArrayList
Private ProcessRunning As Boolean = False
Friend StopProcess As Boolean = False
[Code] .....

View 2 Replies

Running Threads In Thread.Pool Sequential?

May 19, 2012

I have several threads in my WinForm and I am running them via Thread.Pool, what I need to know is that how can I run them sequentially.

example:

Thread1 => me.label1.text = "Thread1"
Thread2 => me.label2.text = "Thread2"
Thread3 => me.label3.text = "Thread3"

In my Form_Load event, I have a line as follows:

[Code]...

View 8 Replies

Execute Multiple Scripts At Same Time, Running On Own Threads?

May 6, 2009

I'm writing a scripter using VBScript, that should be able to execute multiple scripts at same time, running on own threads.
The issue is, I DO start those scripts on different threads, but their sleeps still seem to affect the other threads too.

For example, let's say I start 2 scripts

In the Main event
NewScript1
NewScript2

[code]....

View 1 Replies

Office Automation :: Outlook - Application Running Multiple Threads

Apr 15, 2009

I have an application, running multiple threads, and in many of these threads, Outlook is being called, some mails read, attachments downloaded, and then the outlook instance closed. But it is possible that there are a number of threads trying to do the same thing at the same time. There is of course a lock at the beginning and end of the process, so that no two threads try to access the outlook application at the same time.

"Sometimes" i get an error message : Creating an instance of the COM component with CLSID {0006F03A-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 80010108

View 3 Replies

Running A Progress Bar On A Separate Thread?

Apr 11, 2012

I've made an application which goes through a long procedure when a button is clicked. I don't want the user to think the program has frozen, so I'd like to add a marquee progress bar just to show that it's still running. However, if I simply add the progress bar and make it visible when the button is clicked, the bar will appear but freeze and wait for the procedure to finish before it starts scrolling.

I know this is due to both the procedure and the progress bar running on the same thread, but the tutorials I've seen on getting a process to run on another thread seem confusing. What is the simple way to make a progress bar run on a separate thread?

View 12 Replies

Running Function In A Separate Thread

Mar 31, 2011

when trying to run a function in a separate thread, my reason for trying this is because since the application is only run on one thread, the GUI hangs when the function is called.[code]In this code, the Print screen Button is pressed and the function HookCallBack is called.The problem is that the function has variables that need to be passed and returned, and while searching, i found a website that had an answer for this, and it required the function to be put in a class, and then it could be run on a separate thread while still passing all the variables needed.url...But the code cannot be placed in a class without giving errors and it seems to me like i did something wrong. The code is meant to be used in a form and not a class.My question is, how would i go about running the HookCallBack Function in a Separate thread?

View 5 Replies

Running Process In Separate Thread

Mar 24, 2009

Here's the problem I am trying to solve. My program can export a file as a pdf. and other formats. I can open the file using process.start. My file doesnt have a good name so I am using a GUID as a name.

[Code]...

View 2 Replies

UI Freezes Though I'm Running My Sub On A Separate Thread

Aug 11, 2011

I'm working on a checksum tool, which loads all the files in a specific folder to a listview then, calculates the hash value of each file and save it to a text file.Ok, everything is working properly except for the calculation, when I start it on a separate the my UI freezes.[code]...

View 5 Replies

How To Capture Form Events From A Separate Running Process

Mar 21, 2011

I'm trying to automate a product that provides no such automation capability.I've take a cursory look at loading the app in a separate AppDomain, and also, through reflection, executing the Program.Main() to get the app running. I also tried getting the windowhandle from a separately created Process object (which I've learned will not work).If I have a reference to their assembly added to my project so I can reference an instance of "TheirProduct.FormMain", what, if it's possible, is the best way to go about capturing events from that form? What I need to do is to be able to capture a couple events, and perform a few Button.PerformClick() against the form.

View 1 Replies

VS 2010 : Getting A Running Total Of The Integers In A Separate Text Box?

Jun 25, 2010

I have a listbox with nothing but integers in it.I want to keep a running total of the integers in a separate text box.

View 3 Replies

IDE :: Partial Class Code Behind A Dataset Object / Is It Running In A Separate Thread

Jan 27, 2010

I am instantiating a form object in my code behind the dataset just to access some form level variables and to occasionally set a label in the navigator bar. Recently in the b2 Team version of VS2010 there are some strange errors thrown in the immediate window and then I'm tossed out of debug mode and back into the IDE. This code has been operating for some time in this project without this behavior. A team member has just reproduced the behavior in his development machine also.The error that starts the shutdown of the debug instance is this: Control accessed from a thread other than the thread it was created on.

View 4 Replies

Is Running Multiple Threads Faster Then A Single Thread On A Single Core Cpu

Dec 23, 2009

Say I have a code with 3 methods that do some pretty intensive work. Would executing these methods on 3 seperate threads be faster then executing them one after the other on a single core cpu? And what if it's a dual core or HT?

View 8 Replies

Multithreading - .NET 4.0 Execute Multiple Threads But Threads Are Completed Before Resuming?

Oct 19, 2011

I just had a new, last-minute idea on to take on a task, so I am running to StackExchange for quick help.

What I want to do is execute a series of methods right in a row, each in their own threads. I want the application to wait until all of these threads are completed, after which the program will resume. It also has to use managed threading (thread pool).

What quick examples could you provide to help me along the way? If it's too complex, what things should I know about so that I can Google it on my own?

View 1 Replies

Queue Threads - Spawn A Series Of 'child' Threads From A Loop

Dec 30, 2009

I have a main thread which is designed to be a batch processor - it spawns a series of 'child' threads from a loop (which can vary in terms of the no of items) - see below

[Code]...

However, each of the 'child' threads could take anywhere from milliseconds to about a minute to process - depending on the complexity of each calculation. There may also be a large number of child threads - e.g 100s. Creating large numbers of child threads is not efficient. I therefore want some way to effectively queue each child thread (and cancel if the process is taking too long to complete). Autoevents seems like one way of doing this, but the only examples I can find seem to assume there are two different processes on seperate threads, not one process being repeated.

View 4 Replies

String Manipulation - Separate Three Fields Of The Phone Number And Display In Three Separate Text Boxes?

Feb 23, 2012

I created a telephone number form where the user enters the telephone number in a text box as (nnn) nnn-nnnn. The first 3 digits in parenthesis are the ISD code, the next three are the area code and the last four are the local number. I need to separate out these three fields of the phone number and display in three separate text boxes labeled appropriately. Now, suppose the user enters the phone number in a text box as a continuous string of 10 digits, where the first three represent the ISD code, the next three represent the area code and the last four represent the local number. I'm lost as how to change this string into the form (nnn) nnn-nnnn. This is what I have

[code]...

View 3 Replies

Create Separate Object Instances For New Objects In Separate TabPages?

Sep 17, 2010

I have a TabControl object on my form with many tabs created in code (TabPages) and my problem is that the same objects that are in the initial TabPage needs to be in the other TabPages created in code, I have this done in code when the user clicks the 'New Tab' menu option, however the same code is used for any new tabs created. The problem created here is that I have an event against one of the objects that appear in the other TabPages, but because the same code is used to create any new tab pages, the event will only work on the newest tab page, if that makes sense? By the way these objects that appear on the other TabPages are properties at the top so events can be handled against them in the respective subroutine.

[Code]...

View 5 Replies

Possible To Have Separate Combo Boxes That Will Give Separate ID Values But Using Same Table?

Apr 30, 2010

I'll get straight to my problem - I'm currently coding in Visual Studio.I have a table (countries) with the columns ID | Name. The table is filled with around 28 records.I also have a form with 4 combo boxes (set up as 1,2,3 & 4) that I want the user to select. These combo boxes will display the names from the table countries. I then want to use the selected names in the combo boxes to Insert into their corresponding ID into another table. For example England would have the ID 1, USA the ID 2 etc.So, is it possible to have separate combo boxes that will give separate ID values but using the same table? At the moment I can't seem to find a solution.Eventually the form will have more than 4 combo boxes so I don't want to use separate bindingsources for each combo box.

View 5 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

Jun 13, 2012

How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:

Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()

[code].....

So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:

interface.Economic.MyMethod
interface.Currency.MyMethod
etc

This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.

View 23 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved