Update A Form From A Separate Thread?

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


ADVERTISEMENT

Multi-threading Forms - Open A Separate Form As A Separate UI Thread From The Start Up Form

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

Update UI From A Class In A Separate Thread?

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

Load The Main Form Of A WPF So That A Separate Thread Goes And Gets Data From The Database While The Form Is In An Apartmentstate?

May 15, 2012

How do i load the Main form of a WPF so that a seperate thread goes and gets data from the database while the form is in an apartmentstate? (drag-able / movable) I Know this is possible with opening a new window from your main form like this :

Private Sub openOrderWindow()
Dim OrderWindow As Orders = New Orders
OrderWindow.ShowDialog()
End Sub

[code]....

I've tried putting MyBase.ShowDialog() and .Show() and .9000+ other things The only benefit I've got out of using a seperate thread to load from the databse is i can see the screen right away (as oppose to it being a transparent box until it loads) but i cannot move it around or minimize it?is there any way to make it Movable while it loads?

View 1 Replies

Create New Form On Separate Thread?

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

Doing Work In Separate Thread To Prevent Form From Hanging

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

Run A Method On The Main Thread From A Separate Thread?

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

Update Form Variables During Thread?

Sep 1, 2009

I'm not sure exactly how to describe this. In VB6, there was a Timer command. I could create a variable of type Timer and loop until the current value for Timer exceeded the initial plus a given amount of time. This allowed me to update form variables while the timing loop was executing. How can I do something similar in .NET?[code]...

View 5 Replies

Update UI Form From Worker Thread?

Oct 20, 2010

I am new to multi-threading in VB.NET and have come across a problem whereby I am wanting to append text to a text box on a form from a service thread running in the background.

The application I am developing is a client/server listener, I have been able to get the client and server PC's to talk with each other (confirmed through MsgBox), however I am now struggling to get the service thread on the server to append the text to the textbox, nothing vissible occurs.

I have a form named testDebug which calls a class (RemoteSupport), this class does all the handshake tasks and updates the textbox with the connection data.[code]...

View 2 Replies

Use A Thread To Update Components On Form?

Apr 22, 2012

I have a form that looks like this:and i'm using a backgroundworker to update the components:

Code:
Private Sub btnGO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGO.Click

[code].....

View 2 Replies

Using Thread To Update Label Text On Form

Jun 8, 2010

I run a thread from my main form that do some stuff i want that each action that the thread do will be written on a lable on the main form. How can i do that? I try to give it a pointer of the form but with no luck since its not allowed by the compiler. here is how i create the thread object in my form:

[Code]...

View 2 Replies

Run A Loop In A Separate Thread?

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

Run Timer On Separate Thread

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

Allow A Progressbar To Be Changed On A Separate Thread?

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

Call A Delegate From Separate Thread?

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

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

Update The Button Text On A Form From A Backgroundworker.do_work Event, And It Failed With The Usual Cross-thread Exception Message?

Nov 14, 2011

I tried to update the button text on a form from a backgroundworker.do_work event, and it failed, with the usual cross-thread exception message.However, by pure chance, I also tried to update text in a system.windows.form.toolstripstatuslabel also from this backgroundworker.do_work event, and it DOES work. Question: why is this? Is it perhaps because theres some kind of implicit shared behaviour with system.windows.form.toolstripstatuslabel?

View 4 Replies

Adding Items To ListView In Separate Thread?

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

Create A Timer To Execute On A Separate Thread?

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

Forms :: Load Progress Bar On Separate Thread?

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

How To Set Global Keyboard Hook On Separate Thread

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

Plot Serial Data In Separate Thread?

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

Separate Thread Accessing To Main Ui Controls?

Aug 25, 2009

how to access the main ui's labels from a delegate method?

View 7 Replies

VS 2008 Infinite Loop In Separate Thread?

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

Update ProgressBar From Another Thread (Thread Is Not A BackgroundWorkerThread)

Nov 18, 2009

I have a program that runs for some time and I would like to update the user on its progress. The rest of the GUI is updated using Delegates and Invokes and such (Java is Soooo much cleaner in this regard - everything is thread safe!!), but there is no invoke method for the progress bar. How can I use a delegate to update the progress bar when there is no invoke to invoke!!

View 1 Replies

VS 2008 [Multi-threading] How To Run This Code In A Separate Thread

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

Display A Modal Msgbox When Called From A Separate Thread Process?

May 14, 2010

I'm using VB.net 2005, .net framework 2.0

I'm currently having a form that has a button starting a long process, with feedback into another windows textbox (call frmProcessLog).

I'm using a Background worker to laucnh the process, upgrade the status of the process and display feedback on the frmProcessLog textbox, and to know when the thread process ended up, (from the cancel button, from an error or normal termination).

the main thread process has some msgbox in it, asking questions to the operator (yes/no/cancel).

I've added the msgboxstyle.systemmodal to the msgbox call which works "ok" excpet if the operator decide to ignore the showing message box and click the cancel button on the frmProcessLog form, which is still clickable even though I supplied "systemModal" to the msgbox. this makes the msgbox hidden behind the frmProcesslog form and the process can still continue.

If I close my frmProcessLog form, I will see the previously msgbox behind it and If I end up click one of the button it will end up at an application error because the thread that called it is not existing anymore.

So I would like that the msgbox to be launched from the thread making it as if it was launched from my frmProcessLog window in a modal way.

View 4 Replies







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