Multi-threading - Thread Starts When A Button Is Clicked But Can't See The Result?

Sep 13, 2008

I am using a background thread in my application. The problem is: this thread starts when a button is clicked and it works well. After finishing it's work i can see the result. But when i try to start again, it gives me an error. How to restart a thread?

[code]...

When i press ToolStripButton1 for the first time it works really well. But when i press it second time it shows me error that, the thread has already been started.How to resolve it? I think how to restart thread is my question.

View 2 Replies


ADVERTISEMENT

VS 2008 Multi-threding - Adding Multi-threading Facilities - Cross-thread Operation Not Valid

Feb 10, 2010

I'm adding multi-threading facilities for the first time. I have a function that is wrapped to be run in a separated thread. This function retrieves data (text) from a combobox and it works for sure without multi-threading.

When I call it as multi-threaded, I get the following error when I try to retrieve the data from the cmobobox: Cross-thread operation not valid: Control 'cmb1stBL' accessed from a thread other than the thread it was created on.

It looks like a restriction of thread-safety... I assume that the child thread cannot read from his parent, to make sure that he doesn't change his parent data. So how can I read the data from the combobox? Should I read the comoboxbox data before calling the child thread?

View 4 Replies

Multi-threading - Cross-Thread Operation Not Valid

Aug 25, 2009

I looked around the site and the questions I found relating to this subject were for C# (the application that I am maintaining is written in VB.NET), so I apologize if I overlooked one. Here is where I am calling my thread:

[Code]...

View 5 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

Multi Threading - Crashed GUI - Executes A Sub Of My Choice On A Separate Thread

Sep 11, 2011

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.

View 1 Replies

Thread - Waiting Screen - Button In Application That Starts A Function To Play Sounds

Mar 20, 2009

I have a button in my application that starts a function to play sounds. But when the function starts a have a problem that my application stops working until all the sounds are played. Then a want to display a waiting screen to show the status of the current application. To this i thought to create a new thread to open the waiting window and then show the messages. But i have a problem that when my thread finishes, it closes the waiting screen. I tryied to put a loop inside my thread, but this crashes my aplication until the loop condition is satisfied.

View 2 Replies

Threading Progress Bar In .net - Thread Operation Not Valid Control 'ProgressBar1' Accessed From A Thread Other Than The Thread It Was Created On

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

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

Accessing Multiple Sites Multi-threading Or Multi Browsers?

May 14, 2011

I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?

View 2 Replies

VS 2008 Terminate A Threading.thread Using Thread.abort?

Jun 10, 2010

im trying to terminate a threading.thread using thread.abort the thread runs a download connection so is usually in the middle of socket.recieve or socket.send or socket.connect when aborting i just want to terminate the thread no matter what thread.abort raises an MDA excpetion. so i ticked it off in the debug exceptions menu. now it doesnt raise an exception, but the thread simply wont terminate. my program wont close unless i press top in the debugger.i cant pause downloads because i cant terminate the thread this code wasn't working?

Dim vT As Threading.Thread
For Each vT In clsDownloader.DownloadThreads
If Not vT Is Nothing Then
vT.Abort()

[code].....

as for the exception concerning threads being aborted from other threads being dangerous, how is it possible to send a message from a main thread to another thread to abort itself? as far as i know the only way to a abort one thread from another is to just kill it (because i dont know of ways for a thread to communicate with another).

View 2 Replies

Multi-threading Or Multi Browsers?

May 14, 2011

I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?Not sure which way I should approach this app.

View 2 Replies

Multi-thread Accessing The UI Thread Control, No Exception Thow?

Oct 11, 2011

As we know, one STA UI thread creats the controls only canbe accessed in the UI thread in Winform application. And we need to call control.invoke or begininvoke to run the code in the background thread.

Yes, below code in VB.Net , VS 2010 Winform project can throw the exception "Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on."

[Code]...

View 9 Replies

Best Way Of Multi-threading?

Mar 3, 2009

I need to be able to call a C++ dll that takes a long time (possibly infinte, it relies on user input)to execute. Im calling this through VB. My VB GUI freezes up when this happens, and I would like to keep the GUI responsive, so that the user can stop this possibly infinte loop. A bit of background, the C++ is trying to keep score on a snooker table using a webcam, and while the VB scoreboard updates easily, I would like to script it so that the analysis is almost continuous, while still allowing the user to interact. Currently the project requires the user to press a button to start the shot analysis, but it would be preferable if the program scripted itself. I have only realised this problem now and the deadline is very soon.

Update: Our lecturer suggested an option to solve the problem, but it would appear that most options here and the one he suggested will not work for us as the processing time required for the webcam image capture is too great to handle due to hardware constraints.

View 5 Replies

SMS Multi Threading

Jun 26, 2009

SMS Multi Threading

View 4 Replies

.NET Perform Any Multi-threading On Its Own?

May 30, 2009

I know .Net and C# pretty well, but never even looked at VB.My problem is: our Win32 COM library is used by a number of clients, and we see that the number of failures is higher for those who use the library from VB (both VB and VB.NET) than for those who use C++, C# or Delphi. One thing about our library is that it is supposed to be used from one thread only - can some threading magic by VB be the cause of failures?

Clients tell us the do not create any extra threads on their own.

View 3 Replies

Better Performance With Multi Threading?

Feb 15, 2009

I'm creating a password hash recovery tool that uses brute force. I have the brute force algorithm run in a background worker. It all works, but some similar apps I tried out have performance ~100x bigger then my app. (mine does 50k keys/second, some others do 5m keys/second or more.)I realize this is partly caused by using a .Net language, but I suspect there are ways to significantly speed up the brute force. A lot of ppl say I should use multi threading, but how is this done in practice? Splitting up the passwords to check would slow down my app I think.

View 1 Replies

C# - .NET Multi Threading - Updating The UI On The Fly

Nov 12, 2010

I have a button click event and inside I do a lot of work. While I am doing this work (not from the UI project) I want to send messages to the UI to display to the user.

[Code]...

and inside DoMyWork which is in another assembly i can call SendMessage which writes to the textbox. The messages will only display though when DoMyWork is complete. How can I update TextBox1.Text on the fly without putting DoMyWork on a BackGround thread or do i have to put it on a BackGround thread? I do actually want to block the user from doing anything while DoMyWork is running

View 9 Replies

C# - Multi Threading A Web Application?

Sep 9, 2009

I know there are many cases when it's best to multi thread an application but when is it best to multi thread a .net web Application?

View 5 Replies

Multi-threading In GUI Environment

Jun 22, 2010

I made a simple Form1, with Text.Box1 (starting value=1) and Text.Box2 (starting value = 100000), as shown in the attachment: I wanted that, when the Form loads,value of Text.Box1 keeps on increasing by 2 and value of Text.Box2 keeps on

[Code]...

View 1 Replies

Multi-Threading On Multiple CPU

Aug 20, 2009

One of our products consists of two different services:

- main service that launched at the startup of Wndows
- GUI that launched manualy when needed

GUI is representing data from main service.Main service starts X amount of threads that do some work and gether data.Some minor data and adresses to threads are stored in chache memory, so that GUI will have access to them.Everything works fine in 99% cases, but in some rare cases GUI do not display any data when used on machines with multiple processors (not milti-core). My guess is that it can't access the memory -> probably OS "decided" to run main service on one processor and GUI on another one.Is there any way to access the memory alocated for one processor from the service that runs on another processor?Or is there simple and secure way (same application will be also runing on single processor machines) to specify both services to run on the same processor?

View 4 Replies

Synchronization In Multi Threading In .net?

Sep 10, 2010

I have a question regarding the synchronization in multi threading.

I have a function called send which i am calling in a for loop for every data row.

This function creates threads to send emails to different people.

Public Sub send(ByVal Conn As Data.DataRow, ByVal job As Data.DataRow)
MyThread = New Thread(AddressOf Me.start)
MyThread.Start()
End Sub

But every thread created is writing to a log file at different points of time. So, there are very high chances that 2 threads write to the same file at the same time. So, do i need to use any kind of synchronization mechanisms here ? or is it fine without them ?

View 3 Replies

VS 2010 Having The Multi-Threading IP's?

Dec 11, 2010

I've been raking my brain for quite some time on this. Is there any way with VB.NET that I can use multiple IP's in one instance of a program? For example, I want to be able to navigate to a web page 10 times at once, with each one using a different IP. I want them to be parallel (multi-threaded) rather than going sequentially. Going sequentially, I could just do the action, change the IP, do the action, change the IP.

View 5 Replies

VS 2010 Multi Threading The Right Way?

Jan 10, 2012

I have a button and when it's clicked a HTTP request is sent out to a website to do a few things, but because its got to load the external resources it makes the interface frozen. I've moved the HTTP onto another thread using the follow

VB.NET Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Thread1 As New System.Threading.Thread(AddressOf check_accounts)

[Code]...

When i want to update a label that is on my main form (from the check_accounts sub). I know that isn't the right way, but i have no idea what the right way is. All the documentation i can find is very (excuse me for this) nerdy and really doesn't offer much insight on how to incorporate it into a project.

I want to be able to have a numericupdown box that can let the user change the amount of threads they want to use. I assume more threads allow the http requests to be done faster and at the same time?Also if i wanted to pause the HTTP requests, would the best method to use be pausing the thread?

View 12 Replies

MultiThreading-Insuring A Thread Starts On Each Processor?

Apr 20, 2011

How do I ensure that a process has a thread on each processor?

What I am asking is how do I address processors to ensure a thread is running on it?

View 8 Replies

Adding Multi-threading To Application?

Jun 15, 2009

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.

The section of code with the error

vb.net
Imports System.Threading
Imports SldWorks
Imports SwConst

[Code]......

View 9 Replies

Class Updates And Multi-threading?

Aug 29, 2010

using multi-threading in my application.Basically what i am trying to do from within a form event is initiate a class instance and then run a function of that class (via a thread) that changes certain member values of that class.Those class member values are then used to update values on the main form.Ive created a simple example below but i cant seem to get it to work.The class values are not updating and im struggling to understand how this threading works.

Class FormMain
Private Sub BtnClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles myformbtn.Click()
Dim myFileCounter As New FileCounter()

[code]....

View 10 Replies

Difference Between Multi-threading Vs. Backgroundworker?

Apr 12, 2011

I'm creating an app that needs to navigate to multiple websites, logs me in and then submits my documentation.I've read that multi-threading can handle this task but then I've read something about backgroundworker.

View 1 Replies

Download File Using Multi-threading?

Dec 18, 2010

Download file using Multithreading

View 1 Replies

Multi Threading With Comm Object

Jun 20, 2012

We working with a Modem type interface that use's the Comm port for two way communication. The App starts and sets up the Comm port, and sends config info to the 'Modem'. Trick here is you have specific timing issues that need to be considered, and we got it all sorted, by using Threading.

You send The Config command to the modem and wait X ms for the confirmation reply (Single Byte), If no reply, send a Wake up command, wait X ms and send Config command again. Once confirmed that the modem is in config mode, send parameters, Waiting for confirmation of each one. Once config is set, send the 'Return to normal mode' command and wait for confirmation. [Code]

The SwitchModemMode sub runs under the Comms thread and not the main thread, like the Checkmodem sub at the top. Mostly because the Comms thread Raises the Data Event, which in turn calls the SwitchModemMode. Now because of that the Thread that is supposed to be checking for the input and setting the Flag, is actually the one waiting for the Flag to be set. And Yes App.DoEvents could solve it here, however that can/will mess with the Timing needed with these commands. I'm looking for how to pass the Raised event to the Main thread.

View 1 Replies

Multi-threading Bad File Name Or Number

Apr 18, 2012

I'm using VB2008 express under Windows XP.I have a complex program that processes digital maps. To speed things up I have started to use multiple threads.The program logs diagnostic information as it runs - a file is opened when the program starts, records are written (Printline) to it as required and it is closed when the program ends. All this worked fine until I introduced multiple threads.For the main program it still works fine - but if I try to print to the log file from the code in a started thread there is an IO exception "Bad file name or number". The number (1) is shown by the debugger and is correct.Does this mean that a file cannot be accessed by different threads without being opened and closed for each thread?

View 1 Replies







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