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
ADVERTISEMENT
Apr 29, 2010
I have created a form in which i am loading thousand of records. so i want to display a progress bar.Actually i am moving from MDI main meny to some other form so when i click that menu item i want to progress bar till my total records are not loaded.
View 3 Replies
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
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
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
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
Nov 15, 2011
I have a VB.NET 2010 app that uses a backgroundworker to process MS Word docs. All of the code does what it is supposed to do, except when my code calls ReportProgress(). The UI cannot process the ProgressChanged event fast enough before the values in the class that are passed are changed. I know this because I inserted a System.Threading.Thread.Sleep(100) line after each ReportProgress() call which allows time for the UI to make the updates properly. I guess I am looking for a better solution thanThread.Sleep(100) since this adds to the amount of time it takes to process all of the files. Here are some snippets of code that I am using:
[Code]...
View 5 Replies
Feb 17, 2012
Would anyone be able to help me here please. I'm fairly new to VB.net and threading so im just trying to figure out what is happening.When I debug this I am getting the error thread operation not valid: Control 'ProgressBar1' accessed from a thread other than the thread it was created on.
I'm a little lost as to why the error is occuring or how to fix it. I've had to put the progress bar in a separate thread otherwise the GUI crashes
[Code]...
View 2 Replies
Nov 12, 2009
Preface: I know this is an unusual/improper way to do this. I can do this with a "real" ShowDialog(), background worker/thread, and so on. I am trying to do specifically what I describe here, even if it is ugly. If this is impossible for X reason, I have created a fancy progress dialog for some of our long running operations. I need to have this dialog shown on a new thread while having processing continue on the calling (UI in most cases) thread.
[Code]...
View 3 Replies
Dec 31, 2010
I'm reading data from a serial port, but the DataReceived event of SerialPort is handled on it's own thread. I want to handle this on the main thread, but simply declaring an event and raising it still results in it being processed on the SerialPort thread. I'm assuming I need to declare a delegate I can call, but I don't see how that would work.
For example, I want to call Sub HandleDataReceived() on the main thread from the DataReceived thread, having HandleDataReceived() run on the main thread. How would I do this?
View 1 Replies
Oct 27, 2011
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?
View 6 Replies
Jan 14, 2011
I have on timer thread that needs to pass every time a different data to another running thread to make the calculations.
View 5 Replies
Jul 7, 2010
get the progress bar show the progress of the batchfile running in the background?
View 10 Replies
Sep 24, 2010
Is there a way I can run a loop in a seperate thread and increment a progress bar each time the loop iterates? I am trying to run a loop that will take a long time to complete and I dont want the form to be completely crashed out while the loop is running. There are only two ways I can think to solve the problem. The first way is to run the loop on a timer. This is extremely slow. The other way is to use a thread.
View 1 Replies
Jun 2, 2012
I just finished up my space invaders movement and with all the other timers running it really bogs it down. So I think the best solution would be to make the timers run on separate threads. I know roughly how to do this from a old example I read a long time ago. So I just need a simple sample code to refresh my memory please. Maybe something with message boxes or something to demonstrate the process.
View 1 Replies
Mar 6, 2011
how can i allow a progressbar to be changed on a seperate thread? my code keeps saying that i cannot access it because it was created on a seperate thread:
[Code]...
If it is not worth it, it is not fun - you say programmers are boring but i say they are worth it.
View 1 Replies
Jun 10, 2011
So, I'm having troubles implementing a separate thread. This is because I have a simple class, and in it I start a new thread. So, as it is not any form, I haven't found any way to make it call the function in the UI Thread.
So, I cannot use the Invoke method. Is there any way to call a function from another thread?
View 2 Replies
Jan 10, 2010
I would like my application to do something (in one form) and while form is doing that i would like to show another form to the user. Code is:
Private Sub blaa()
Dim a As New Working() 'working is another form
a.Show()
'Do some stuff
a.Close()
End Sub
But when i make new form i find it is on the same (main thread) and therefore new form also frozes. How to make new form on separate thread?
View 4 Replies
May 9, 2010
I've looked at the on line doc over and over, and I can't seem to figure out why this won't work. This code runs the thread, and the thread seems to execute the code in the 'threadsafe' sub, however neither the progress bar is updated or the button click performed.
Imports System.Threading
Public Class VisNotify
Inherits Form
[Code].....
View 4 Replies
May 4, 2010
The code below works fine when I put it in form1.vb and change "form1" to "me" but I can't seem go get it to work from my class.
VB
Imports System.Threading
Public Class Class1
[Code].....
View 2 Replies
Jan 26, 2010
For some reason, the following code is causing me some issues. This code pulls lockout status data from AD and contains the data within a datatable. An event is raised from the threaded procedure to add the data to a listview control. For some reason one row of data gets added to the listview control and when you run the procedure gain, 2 rows of the same data gets added, and then 3 rows, etc.
This code calls the procedure "CallGetUserLockout"
GetLockoutStatusToolStripMenuItem.DropDownItems.Add("For Current User - " & User, Nothing, AddressOf CallGetUserLockout)
[code].....
View 3 Replies
Jan 23, 2012
Currently I'm creating a task that runs a hardware i/o loop for the duration of my program.i.e. it's a task that's created at the program's start and runs a loop that is only broken at the programs termination. Each loop cycle communicates via ethernet to hardware.depending on time outs each cycle takes 30-300 msec)I've noticed that if the loop runs with out any break that the program really slows down... to counter act that I placed a thread.sleep(x) in the loop
View 6 Replies
Apr 29, 2012
After many searches i end up using this class for global keyboard hooking. Link: Global Hook post [code]My app is performing operations that take some seconds to complete (ftp upload small files on interval), and during this time the hook lovks the keyboard. This i dont want of course..I cant jump to Async FtpWebRequest right now because it needs many changes, so i thought that the solution would be to make the hoook live in another thread.A proposal is to move my time - consuming operations (upload) to another thread.Upon doing this i am facing other problems. Because the time consuming task (upload) is in a timer i would have to rewrite a big portion in order to synchronize the file->save with the file->upload and i dont mind the app locking for 3-4 secs. what i do mind is to loose the kayboard for 3-4 secs.
View 2 Replies
Dec 29, 2011
my application receive data from serial port and store it in ConcurrentQuequeFor not lost any data from serial port I need to plot it in a separate theadin SummaryForm Load = set all parameter of ZedGraphPulsante Start = Open serial Port and start Thead
View 5 Replies
Aug 25, 2009
how to access the main ui's labels from a delegate method?
View 7 Replies
Jun 25, 2010
Im working with and trying to run an infinite loop on a new thread which at some point takes action (e.g. make changes to Viewport3D). But no matter what I use:
- BeginInvoke
- Background Worker
- Timer
I run into problems. My porblems are:
[Code]....
I am doing all this in WPF.
How can I run the loop in the background and get it to affect the Viewport3D controls content without throwing an error or freezing up the application? A Viewpoirt3D is a control in WPF.
View 5 Replies
May 9, 2011
I have a really simple form with a button that fires a Sub I created which gathers data from ActiveDirectory and adds it to an Excel Sheet. The problem is, when I click this button the whole form hangs. So I figured the operation that gathers the data and adding it to the Excel sheet should be run in it's own thread, so that the form won't hang. Possibly it would be great to add a progressbar as well. The progressbar however is located at the Main userform that starts up once the projects is run.
I've got one MainForm.vb and one CodeFile.vb. I want most of the code in the CodeFile.vb so it's tidier.
MainForm.vb
Imports User_edit.CodeFile
Imports System.ComponentModel
Public Class MainForm
Private Sub btnImportData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImportData.Click
[Code] .....
Notice the ExportFromAD Sub I've got in the CodeFile.vb. This is what is actually doing the work. In the For each loop that adds data to the Excel is where I've put the MainForm.MyBackgroundWorker.ReportProgress(i * 10). Problem is, it doesn't actually update the label on the form. Which I find pretty weird because the form isn't really hanging or anything. Is it trying to access a different thread or something? Meaning, the form is run on it's own thread which can't be accessed from my second thread?
View 2 Replies
Apr 21, 2009
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.
View 3 Replies
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
Dec 14, 2009
I would like to get a progress bar to actually follow the work being done in my application. In other words I load application and then the user loads a database by clicking file open etc... I would like to have a progress bar run until the data file and all text and labels are completely loaded Is that following a thread? forgive me if I am way off, still learning
View 4 Replies