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.
I have a few forms that have a lot of really intensive updating along with a great deal of user interface (text boxes, button clicking etc) Is it possible to open a separate form as a separate UI thread from the start up form that called it to "show" or open or whatever the new method might be?
I would like some advice on multi-threading. I currently utilize two threads, one for the GUI, and the other for calculations. This works well, but I want to improve my multi-threading techniques. Currently the data is with the calculation thread, and this occasionally this will cause a slow down. I want to put the data on its own thread. Giving me three threads, Data, UI, and Calculations. This should improve responsiveness, and not be overwhelmingly complex.
My problem is, this no longer fits into the parent child relationship well. All three threads need to interact with each other. My question is, what is the better way of dealing with more than two threads, when all the threads need to interact with each other. Should I pick one thread as the ultimate parent, say the data thread (I pick this one, because it seems to me this thread will be the most free.) Then have the calculation thread and the UI thread children of the data thread. Then when I have a need for the UI thread to explicitly call the calculation thread, I do this through a function in the data thread.
What's happening is, i see the threads stop after the function dwnld is completed. So i first check for the state (12 means background and unstarted). On case 12 start the thread and in case 16 (stopped) remove that particular thread and add a different thread like i add 10 above. Also there is a check when the i counter reaches last number, restart the whole loop by assigning i=0.
The program downloads some web pages, the url is passed from the listbox2. The geturl will pass the url and remove it from the list. So when the listbox is empty, exit the for loop. But the above code is running for only 11 times and it does not restart. I tried using a lable and goto but it simple hangs. What i want is to maintain 10 threads to keep downloading the web pages and when the list is empty, exit the function.
In one of my multi threading programs I cannot get my threads to abort. I have about 5 threads and the threads starts one at a time. By the time the fifth thread is started the program gets really slow. The program will not execute pass LoadWheelStn1.
Code:
Private Sub LoadWheelStn1() If sPortOpenFlag = "T" Then Dim MyThread1 As New Thread(AddressOf ThreadStn1)
When the program starts, it checks for the amount of threads the user wants to use to download files with. The threads are then created. When the user chooses a file to download, the threads begin grabbing the file until it's fully downloaded.The problem is, some threads stall right from the start, & just sit there doing nothing.The global work variable is Sync-Locked, then quickly released by each instance, & to my eyes, there is nothing wrong.They are all instances of the same class, & do the exact same thing, so why is it that some run, & others don't?VB.NET is the programming language. They are looping Background workers.I would really like to know why some run, & others don't.btw... they have quick non-blocking sleeps, as well as blocking sleeps to allow others the chance to run (proprietary non-blocking DLL).So all i'm left to think on is that Microsoft's process queuing has some type of bug going on in there someplace....or is there a way to do multiple looping threads where they're guaranteed to run?
I started a threading project and want to manage my code so that it waits for all the threads to be finished before displaying to the user on the main UI thread that it has completed the task and waiting for the user... I've created a List to manage the threads and a global Boolean, "blnStop"...
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.
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.
I'm trying to make a multi-threading app which extracts the names from my site. I have 1000 pages celebrity related. The urls are on a listbox List1 and the number of threads are specified in TextBoxThreads I would like each thread take care of a coresponding url on list, when they finish go to the next one and so on (for each thread a url)
I am creating an IDE for a game script with similar functionality as the Visual Studio IDE (at least, some of it). The game script consist of code that looks visually a bit like C code. It uses braces to define the start and end of a 'class' and uses nested braces to define the start and end of an 'event' in a class.
What I want finally is to have two Comboboxes above the text editor, one that lists each Class and the other listing each Event. The comboboxes should also show the Class and Event that the caret is currently in, just like in Visual Studio.I have attached an example of such a script (you can open it with Notepad).However, here is a short example where you can also see how I "defined" classes and events:
class1 { event1 {
[code]....
As you can see, the classes are the 'names' of each block of code, defined by matching braces { }. The events are the names of each nested block of code, also defined by matching braces { } but inside a class. There is only one level of nesting.As you can also see, the layout can follow the standard C-style layout, or a slightly different layout (using the opening brace on the same line as the class/event name), or even a completely chaotic mess. As long as the braces match correctly, the code is valid.So in short, the large blocks are classes, while the nested blocks are events.
What I want to do, is parse an entire script, and store all the Classes (and eventually, also all the Events, but let's forget about them for now). I want to store the Class name, start position (defined as the start index of the name), end position (defined as the index of the closing brace) and the full text (defined as the text between start and end position, so including the name).
vb.net Public Class clsClass Private _Name As String
[code]....
The code works basically by finding every first opening brace (the opening brace of each CLASS, not event), and then loops through the class (using a brace counter to keep track of the nested braces) until it found the last closing brace. It then stores the name, start, end and fulltext in a new clsClass and adds it to the list to return.
How can I make my apparently so that when I click a button, it executes a sub of my choice on a seperate thread? I need this to send an email and when I ran it normally it crashed my GUI.
I am looking at adding in some bluetooth functionality to my vb.net application. I require it to couple with a specified mobile phone (that is found by the app) than to be able to retrieve contact information, phone calls (made and recevied) and images from the phone.
Can anyone tell me what my best approach will be for this? If there are any good third party solutions that will do it? If it is actually doable? Im thinking that it should because im basically mimic'ing what all the new fancy cars do with their bluetooth phone compatibility.
I have been building a Web Application (ASP.NET, .NET Framework 4, VB, visual studio 2010). To be very brief the application interacts with a database and performs several actions (Insert Delete Select etc..).I am using several Gridviews, ListBoxes etc and I am not happy with the presentation outcome and the functionality provided by asp.net. In simple words my application looks bad, outdated and unprofessional.I figured that using Windows Forms that will be incorporated to the ASP ap.I have created a Windows Form Control Library to use the dll created in my app as a user control. I found out that this is not supported in .NET Framework 4 (is this true? or am i doing something wrong?). Is there any way to make my application have the 'look and feel' of a windows application? Please note that it is has to be a web app and the clients should not have to download any other application to interact with the server.
I am using VB.NET for coding and SQL Server 2005 for database.My application is ready for release. Just on thing missing before I can go live.I want to implement license concept in my application.My license file can be text or xml file. In which there should be some encrypted matter which will be used for validate the application.how I can implement this functionality in my application.
I'm trying to implement cut, copy and paste functionality in my application. My menu is on the main form of my MDI application and I would like to cut copy or paste from any textbox from any mdichild.
I recently began working on an application that was built by someone that is no longer available. This application is filling an excel file, but I can not find ANY code that uses excel. There aren't even any references to excel interops. My thought is that this a multi-threaded application and I can't see what is going on behind the scenes. I tried watching the processes in the task manager, but found nothing.I've never worked with threads before, and do not even know where to begin. Debugging the program with breakpoints at multiple locations does not show me any of these other threads. Anyone have an idea on how to find/debug threads of a program?
I know increasing the no . of threads causes risk and many other issues bu i wanted to know what is the maximum no. of threads that my vb application could open..... and is there any way by which i can determine how many threads are currently open in my vb.net application?
I have some functions in a web application that do a lot of calculations and as a result have high CPU usage which affects the rest of the application when other users are accessing it. I have tried background-worker to no avail , the only thing that seems to work in using another thread and setting the priority to low, can the UI be updated from a worker thread? specifically I am trying to bind a grid to a dataset processed in the worker thread
i have a vb.net application that plots 16 plots immediately, the plots data are realtime. the 16 plots must draw the points at the time they receive them (must be no delay), to do that
1- i made a timer with ticks at 50 ms.
2- at each timer tick call the plotting function 16 times (with a graph name as parameter)like that: [code] it made a big delay, when i used threading the application became unresponsive.
This is probably a pretty novice design question. I'm trying to work my way through a number of requirements and give the users the experience they're looking for.I've written a tool that does big calcluation-type things. It currently consists of a class library and command line tool (separate .NET projects.) We're using an Access database format as the file type because it can keep all the various tables together in one file. A few other items about the application: There are not many users. There are no concerns with scalability. There are not great concerns with updates. Desktop is desired. Not web.Using VB and .NET 3.5 SP1
I now need to develop a GUI front end that will allow typical File/Open and File/Save type operations.Users expect that they can open a file, edit it some, then either choose to save it or close it unsaved without any changes being written back to the file. Saving it would obviously save all changes affecting all tables back to the file.
Does it then make sense to use a temp file for something like a proxy then? To, when a user "opens" a file, copy the source Access file to a local temp file and then use that for the editing session? Then, if the user "saves", copy the local temp file back to the source path?
Update: [tagged with ms-access tag too] Also, I omitted the fact that users would expect typical File / Save As functionality too. I think the design I've put in question in this post is what is traditionally called the Proxy design pattern. Has anyone tried this (successfully!) with Access database files before? Words of caution or advice?
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.
I need help to implement multiple threads in application.Assume ds.table(0) has 5 and sometime 6 rows rows for i=0 to ds.tables(0).rows.count-1.I have to apply multiple threads, means all five/six rows should start at once using thead and "Process 1" .."Process 4" should also handled by threads.This is hierarchy that I have to apply with threads, how can I do it. It is requested to put piece of code so I can understand better.
I am working on adding multi-threading to my application. I have done two applications using multi-threading following a tutorial of sorts, and modifying the code to "get my feet wet."
This is the first time I am trying multi-threading within my own application, and I feel I should be beyond this type of problem, but after a 3 hour search on the forums, I can not find a solution, so I am posting this thread.
I have a console application that is built in VB.Net. Now I have a timer in that application. All I want to do is at a particyualr time i will call another exe (which is built in VB 6.0) and again get the control back to this console application. Now what is happening is that I am being able to call the second exe from the console application, but then the control is not returning back to the same console application.
My mdi VB.Net application performs a long operation on some data. Ideally I should use a separate thread to prevent the dreaded "Not Responding" message.My problem is if I use a separate thread users then have the ability to click on other controls in the application which can directly affect the operation my background thread is working on, creating an error.
Is there any way to prevent all the mdi windows, toolbars and other controls from receiving mouse clicks and keyboard input during my background thread's operation?
Or is there a way to clear the message que before performing a Application.DoEvents?
I have written below console application in VB.net. My intention is to write an application that triggers every one minute and perform some task. But when I run this application it is consuming 50% of CPU.
I am working on an application that is taking pretty long to execute. I started playing with mutli-threading and it seems to have greatly sped up my app. Problem is that threads are still executing and the rest of the code executes before the threads finish. Here is my
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?