VS 2008 Add Threads And Then Something Else Has Stopped?

Mar 3, 2010

I have a process that may take a while, so I decided to put it into a thread and adding some GUI (progress bar) to calm the users down while it's working in the background.The thread itself is working properly.The problem is that the cursor, which I wrapped with a 'sandglass' before using the thread ("Me.Cursor = Cursors.WaitCursor"), has stopped working, and I can't figure out why. When I debug, it's getting inside the function and relevant line - but ignore and do not change the cursor.

Attached is the code, before and after:

Before - working properly:

Private Sub PictureBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetReport.Click
Me.Cursor = Cursors.WaitCursor
If IsValidatedFields() Then

[code]...

View 3 Replies


ADVERTISEMENT

VS 2008 - Process X Has Stopped Working

Nov 5, 2010

I am launching a new process from within my application and it works fine. The problem occurs as soon as I physically close the spawned process; I get a message from windows saying that "Process X has stopped working." If I kill the process programmatically in the calling .NET application, all is well.

View 6 Replies

VS 2008 - Build Must Be Stopped Before Solution Can Be Closed

May 20, 2011

When the Visual Basic compiler (Vbc.exe) crashes, Visual Studio fails to detect this and becomes stuck in an inoperable state. The "Build" menu appears as it would if the solution were building, but the Cancel Build (Ctrl+Break) menu item has no effect. Trying to close the application or the solution gives the error:
"The build must be stopped before the solution can be closed."
I can't find any way to remedy this short of terminating the devenv.exe process and restarting Visual Studio completely. Is there anything quicker and less severe?

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

Auto-comment ' In VisualStudio 2008 Stopped Working / How To Enable It Again

Aug 2, 2010

The auto-comment option in my Visual Studio 2008 suddenly stopped working. o_O..Does anybody know how to repair it and enable this feature again?I'm putting triple apostrophe above function and comment tags do not appear.

View 1 Replies

Auto-comment ''' In VisualStudio 2008 Stopped Working - How To Enable It Again

Jan 5, 2010

The auto-comment option in my Visual Studio 2008 suddenly stopped working. o_ODoes anybody know how to repair it and enable this feature again?I'm putting triple apostrophe above function and comment tags do not appear

View 4 Replies

VS 2008 - Multiple Threads - Get Two Value?

Jul 28, 2010

I'm testing here something, but i don't know what's the best way to do this.I have a var that tells the application the number of threads that will be started, inside the thread/function that i call i need to return/get two values i have two sub functions, each one returns an integer.Then in the end i need to sum the values.

Example:
Thread1/Function
SF1 - Returns 2
SF2 - Returns 3

Thread2/Function
SF1 - Returns 1
SF2 - Returns 5

After all threads are over, i get the
SF1Total = 2 + 1 and
SF2Total = 3 + 5.

I'm thinking in using shared vars, and inside the function/subfunctions update the values. It's this a correct way to do it? Other question, the threads are assync, but i need to know when the last one finishes. How do i control this? The order they finish doesn't need to be the order they were called....

View 4 Replies

VS 2008 How To Stop Threads

Sep 21, 2011

VB CODE
Private Sub pstart()
Dim i As Integer

[code].....

View 5 Replies

VS 2008 Threads - Create New One Or Re-use Old One?

Apr 9, 2010

I need to 'download' the contents of an XML file that resides on some web address and parse them. I need to do this about once every 5 seconds. I use a HttpWebRequest to do it, but I don't think that's relevant.The 'problem' is that this request + parsing can take a little bit of time, and even more time if internet is a little bit slow. So, I decided to do it in a background thread.I have a method, let's call it GetXmlInfo(), which does all the hard work. Then, I have a timer that ticks every 5 seconds. Now I have two options for starting the thread.Option 1: creating a new Thread object every time the timer ticks:

vb.net
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick Dim t As New Thread(AddressOf GetXmlInfo) t.Start()End Sub

[code].....

In option 2, when the GetXmlInfo method has not finished yet, no new thread will be created and the GetXmlInfo is 'skipped' for one timer tick (or possibly more). Could this create a sort of "deadlock" (I know it's not really a deadlock), like if the thread never finishes for some reason?

View 4 Replies

VS 2008 Multi-Threading With More Than Two Threads?

Jun 5, 2009

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.

View 2 Replies

VS 2008 Multiple Threads Ending?

Jul 29, 2010

In the same line of this thread Now i have a problem with the control of the ending threads. This is my

vb.net threadsEnded = 0 For j As Integer = 0 To numThreads - 1

[Code]...

Some times the application doesn't finish and if i pause the application i see that the threadEnded var doesn't have the correct value, seems like some thread doesn't update the value of the var.

View 5 Replies

VS 2008 Passing Values Between Threads?

Oct 26, 2009

I am trying to get into vb.net but having an issue getting a variable value from a class library in a different thread.

What I am trying to do is create my own Winsock type control for my own use. Once data arrives I try and pass it back to the main application so that I can read it and process it.

So far I cant get it working at all. I have tried the following

Raiseevent

I try passing the value as a variable in the raiseevent property. This triggers an error about the value being in a different thread, I always thought that it would create a new variable in the thread of the application it was raising an event in and copy the value.

Function

I have tried writing a function into the class that I call (much like how the winsock control works) so that the class can return the value to the main application.

aka
strData = Myclass.GetData

in the class it returns the value and clears it from its own local variable. This however means the value returns to the main application as nothing even if I step through and see it assigning a value.

View 12 Replies

VS 2008 Shared Sub And Multiple Threads?

Sep 4, 2010

I have a created a class, which contains a sub routine.This sub routine, should ideally be accessable by objects which are not members of the class, so I would like to make the sub, a 'shared sub' (call it Sub1).

Question: I am using many threads and there will be possibly 100s of 1000s of threads all wanting to use Sub1 (which is at present, is not shared).At present Sub1 , is not a shared sub, so every time a thread wishes to use Sub1 , I am creating a (dummy) instance of the class and then applying Sub1, to that instance.

My program works flawlessly using the above technique.Question: If I were to turn Sub1 (which is not currently shared) into a shared sub, and directly had various threads calling Sub1, would there be any issues with locking, ie. would it possible for 2 threads to enter that thread and start overwriting variables, which another thread has written to?

NOTE: there are no shared variables/properties in Sub1 and all variables used in Sub1 are declared within the sub itself.

View 7 Replies

VS 2008 - Safe Cancellation Of Unknown Threads

Jul 7, 2011

I have got my multi threaded application running which is a Windows Service Project.

Basically when the service starts it starts a thread listening on a port for connections. The reason I started this on a new thread was so I could easily control it and not lock up that main worked thread.

Now on that thread when a client connects it dynamically assigns them another port number that is not currently in use and starts a new thread listening on that port and waits for the client to connect to do the actual data crunching.

So basically I have my main project thread, a Main listening thread then the possiblity of 0 to 100 more threads for each connected client.

Now this project should always be running but in the event it needs to be shut down (or server rebooted etc) I want to be able to shutdown the threads safely.

I can down my main listening thread safely but my trouble is all those other possible threads. What I would like is if the service is called to stop I want any of those other possible running threads which would have an active connection to the client to send a simple command like 'STOP' then close the connection gracefully (MyConnection.Close) and end itself.

The only solution I can think of which I don't really want to do is have a global varible (StopThreads as Boolean) and after each command in the thread check that boolean and if its set to true jump to some code to do what I want and end the thread but there must be an easier way? Or is this the best way?

View 4 Replies

VS 2008 Cross Threads -- Lost In Space?

Feb 5, 2012

Frankly, NONE of this makes sense to me..[URL]..They just jump right into code without baby steps that explain the situation.Every other aspect of VBnet has been well spelled out to me and I get it -- but this business of using the serial port and going nowhere because of a cross thread error has me 100% baffled.

If anyone can point me to a tutorial that really explains it simply and well (without jumping into friggin' code).Even in the above link, they show 3 different techniques of addressing the same problem ! (Like I CARE

View 5 Replies

VS 2008 Get Threads To Read Different Lines On Textfile?

Dec 5, 2009

I want to create a set amount of threads, and have those threads open the same file, and then each thread will go read a different line all the way down to the end of the file. Also I do not want to use thread pool, so I have to create the threads. I have the code to create threads, but I need help on the file part:

[Code]...

View 9 Replies

VS 2008 Updating SQL Database From Multiple Threads?

Oct 28, 2009

Is it safe to update an SQL database from multiple threads at the same time? I have a method which runs on up to 25 thread pool threads at the same time and it attempts to write to a text file and update an SQL database - I assumed that writing to the file would not work properly if all threads tried to write to it at the same time, so I have used SyncLock for that part of the method. Just wondering if I need to do the same thing for the part of the method that updates the SQL database? or is the framework (or SQL server) smart enough to either execute multiple update statements on the same table at the same time without a problem or queue them?

View 5 Replies

VS 2008 [RESOLVED] Threads And Problem With Form

May 26, 2009

Hi

I have a thread that it calling many processes.

While the processes are executed (spends some seconds or minutes in completing all the tasks) I show form "Please wait to complete all tasks".

But one of these processes I have to show a form because the user has to choose a few data. But the problem is that this form is showed minimized.

Already I have tried to show it maximized and to bring it to the front but it does not do it.

how I can show this form to front and maximized?

My actual code is:




f= New frmLPlantillas
f.WindowState = FormWindowState.Maximized
f.BringToFront()
If f.ShowDialog() = DialogResult.OK Then
value1= f.xxxx
value2= f.zzzzz
value3= f.aaaa
value4= f.bbbbbb
Else
Return False
Exit Function
End If

Thanks in advance.

View 5 Replies

VS 2008 - Use Threads In Loop To Make The Application Less CPU-intensive?

May 4, 2009

I am trying to stop the following piece of code from taking up too much processing power of the PC by using threads. But I keep getting errors when I use threads:

[Code]...

View 3 Replies

VS 2008 : Have Multiple Threads Input Data Into The Same Arraylist

Dec 20, 2009

I want to have multiple threads input data into the same arraylist, so they would need to share it. If this is possible how can I do this task?

View 1 Replies

VS 2008 Piece Of Code Involving Threads And Events ?

Nov 25, 2009

This is a very simple piece of code involving threading and events. I am just refreshing the old grey matter as I find myself off work sick for a period of time.

Code:

Imports System.Threading
Imports System.Threading.Thread

Module Module1

[CODE]...

View 5 Replies

VS 2008 Manage / Start Two Threads Which Read Some Elements In An Array

Jun 5, 2010

I have a function which does some processing. Lets name that function DoWork. This function takes some inputs as structure and a string. Now I want to start two threads which would read some elements in an array and then call DoWork with some data and value of that element. DoWork would do processing and thats it. I want two threads to run side by sid.

So I tried to write code but kinda failed. I wrote a function which starts a thread and calls DoWork. Now DoWork accepts structure and string etc. But when we do say abcthread = new threadig.thread(addressof <sub name>). here we cant pass any-value except object. That was first problem.

Anyway, main problem is after the thread has finished processing DoWork, how do I find that out and tell that thread to take another element from array and start again. This has to be managed for both the threads. I need to find out which thread has finished first and tell it to start again with another value. I have usually used one thread but not two in this way.

View 15 Replies

ASPX Stopped Working On IIS 6

Apr 20, 2009

this site used to work, i had to reformat the server, republished site though frontpage and i get this

View 1 Replies

Databinding Has Stopped Working?

Oct 9, 2009

I have been developing this VB application for some time now in Visual Studio 2008. I have created datasets, ran into problems, reinstalled them, etc. and have been able to resume work with my application. Just recently, the datasets have completely stopped working meaning no data is pulled from the SQL server. I have tried recreating the datasets with no luck. When I create a new label and try to simply associate it to a SQL field through the properties of the label, Databindings... Text (to pull in the value of the field to this label), when I run the program, it does not pull the data. None of the datasets work. I have checked the code and designer and tried to compare it to my old version and everything looks fine.

View 4 Replies

File.exe Has Stopped Working?

Mar 11, 2012

I just complete my assignment, everything work perfect on my computer. but when I copy this EXE to run on other computer I got an error

"XXX.exe has stopped working?? "

this project has no any dll file. I use only import System.Data.Oledb

View 4 Replies

If A Process Is Stopped Then Re-opens It

May 1, 2011

I want to make a program that, when a certain batch file is closed, that it immediately re-opens it. I'm trying to use the If statement like [Code]

View 7 Replies

VS 2010 Has Stopped Working?

Nov 20, 2011

my program connect to Access DataBase 2003 ! in my computer every thing be ok !but in other pc my program can not open on show this message :

my OS is 7!my VS version is 2010 and it is my connection string : "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + My.Application.Info.DirectoryPath + "my_db.mdb" where is my problem ?

View 2 Replies

Application Has Stopped Working Error

Oct 29, 2009

I keep getting an error that says hte application has stopped working and Windows is searching for a solution. When I click to debug, it tries to start a new instance of VB, but then tells me that a debugger is already running. Why is this happening?

The error is a uncaught Win32 exception and occurs somewhere inside a thread that I create, but I have no idea where.

View 3 Replies

Application Suddenly Stopped Working?

Feb 6, 2009

i tried updating my application on a vista home basic laptop. i get "myapp.exe has stopped working" then i restore back to the old version, it still give the same error. I am sure the old version is working because I tested it before updating it.

View 2 Replies







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