Why Does A Nearly Empty VB.NET Program Use 4 Threads?

Mar 17, 2011

I just noticed after adding the threads column in task manager to Win7 that a fresh new VS2005 project with single form and no code compiles and runs with 4 threads. Does anyone else notice this? Can anyone tell me why?

View 3 Replies


ADVERTISEMENT

.net - Feedback From Threads To Main Program?

Jan 27, 2011

My software will simulate a few hundred hardware devices, each of which will send several thousand reports to a database server.Trying it without threading did not give very good results, so now it's time to thread.Since I am load testing the d/b server, some of those transactions will succeed and a few may fail. The GUI of the main program needs to reflect this. How should the threads communicate their results back to the main program? Update global variables? Send a message? Or something lese?

Now, if I update only at the end of each thread then the GUI is going to look rather boring (and I can't tell if the program hung). It might be nice to update the GUI periodically. But that might cause contention, with threads waiting for other threads to update (for instance, if I am writing to global variables, I need a mutex, which will block each thread which is waiting to write).

I'm new to threading. How is this normally done? Perhaps the main program could poll the threads, instead of the threads iforming the main program?

View 1 Replies

Maximum Threads Usage In A Program

Jan 27, 2010

Maximum threads usage in a program

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

Threads Program Uses To Scape List Faster?

Nov 22, 2011

Im making program that scrapes things from big url list, is it possible to make user set how many threads program uses to scape list faster? If its possible,

For each url as object in urllist.items Do something.Next If can be made into that, would be nice :P

View 9 Replies

VS 2010 - Creating New Threads From Set Amount In Program?

Jun 1, 2011

How do I make my program create new threads from a set amount? For example if someone typed "60" in a textbox and they pressed "Start", it would create 60 threads that would do the same function.

View 5 Replies

Create Multiple Threads To Improve A Function On Program

Sep 7, 2011

i need to create multiple threads to improve a function on my program. it is a simple thing really but it's slow and if multithreaded it can improve the speed some thousand times. my program uses a dll to check the MX record of an e-mail from a textbox called emails if the mx record is correct then it validates that domain, if not, it sends to an error textbox with that mail my problem is that im reading a lot on multithreading and i dont have an idea how to make something like this: for x=0 to emails.lines.count -1' start a thread that runs my function next if i can limit the number of threads to avoid crashing it would be good.

View 5 Replies

Should Threads Update Global Data In The Main Program

Mar 18, 2011

I want to launch a bunch of threads, each performing the same task, and know in main() when each finishs and it if it was successful or failed.The solution offered was to use a ConcurrentQueue, but other posts have recommended using a BackgroundWorker Class, or a thread pool.Is there a definitive answer?Again, all threads perform the same code and have a pass/fail result. I want to run more than there are available threads so as soon as one thread finishes I will launch another asap - I want tehm to stress a remote systems as much as possible (reather than stressing my local PC with too many threads, so I will need to experiment to determine the optimal number of threads).

View 4 Replies

Program Crashes When Datagrid View Is Empty?

Apr 13, 2012

my program crashes when my datagrid view is empty.

It crashes at this

M = Allow_grid.SelectedCells(1).Value

I know its because the grid is empty. when the grid is empty it has a "-1" as the selected value index right?

Is ther a way to test if the index is "-1".

if grid_selected index <> "-1" then
M = Allow_grid.SelectedCells(1).Value
else

[Code]....

View 2 Replies

VS 2010 : Allow The Program To Exit While The Textbox Is Empty?

Feb 27, 2012

how I can allow the program to exit while the textbox is empty but I can't figure out how it works really..it will not allow me to exit,enter, or tab out of the textbox while its empty.

Private Sub gradeTextBox_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles gradeTextBox.KeyPress
Select Case e.KeyChar
Case "0" To "9", vbBack, vbCr
e.Handled = False

[code]....

View 5 Replies

Forms :: Get The Message That The Local Database Is Empty But The Program Still Runs?

Dec 27, 2011

I'm having an issue with the startup of my build app with vb2010.Let me explain what the situation is at the moment.

I have a form and a splashscreen. I use the application events (startup event) to check if there is a network connection, if so the splashscreen will run and it will check if the database is available, if this is the case, it will copy the online database to the local ms access database.If the startup check of the network is false, it the user gets a message that there isn't any network available and the program will try to run normal, then when the user clicks the ok button of that message, it will check if the local database has any records. If so the splashscreen will run and the program starts normal (without copy the database, because there isn't any network available).The issue that I am having is, that when there isn't a network connection and the local database is empty, (I do get the message that the local database is empty), but the program still runs, while it should exit.Here is the code of the application event:

Protected Overrides Function OnInitialize(commandLineArgs As System.Collections.ObjectModel.ReadOnlyCollection(Of String)) As Boolean
Me.MinimumSplashScreenDisplayTime = 5000[code]......

View 19 Replies

DataGridView - Convert Nulls To Empty Strings And Display It In The Grid As Empty Strings

May 14, 2009

I have a DataGridView that has some columns with dates. It binds to an in-memory Datatable which gets loaded from an string array of data passed back from the backend Some of the rows returned have nulls for the date columns. Solution 1: If I define the Date column in the DataTable as "string" I can easily convert those nulls to empty strings and display it in the grid as empty strings (desired results). However, if the user clicks on the date column header to sort by date, it doesn't order the rows as you want. You get a purely string sort order. Not acceptable

[Code]...

View 2 Replies

Nothing Equals String.Empty, Null Does Not Equal String.Empty?

Jun 28, 2010

This must've have been asked before but I couldn't locate it. In a mixed code project (VB and C#) we were debugging some old Visual Basic code where a statement as follows could be found:

If Request.Params("xxx") <> "" Then
'do something

I considered this a bug as Request.Params could be null, in which case the statement would've become false which wasn't the idea. So I thought. I just found out, -- probably for the tenth time and I will keep forgetting -- that the following two statements are not equal, while Nothing in VB should be equal to null in C# (thought I):

if(String.Empty == null) // always false
If String.Empty = Nothing Then ' always true

Should I dismiss this as a typical Microsoft backward compatibility effort, or should I consider this a huge error in the VB.NET compiler? Does anybody know the Microsoftean opinion on this oddity?

View 3 Replies

Arrays - If Not String.Empty Ignoring Empty String

Aug 11, 2010

I have a array of strings and I am looping through them, but the string might be empty so I am trying this:

[Code]...

View 3 Replies

.net - ASP.NET Two Threads, One Result?

Sep 14, 2011

I need to run TWO Threads in a web application, .NET. 3.5 Both methods MakeRedCars and MakeBlueCars need to run at the same time as both take 5 seconds. I have tried many example codes with very bad results. I dont need anymore than 2 threads. The main issue I am having is knowing how to wait till they are finished and also how to store the results from each.Each of the Methods do different things, one is a web request, one is a sql call.

Both methods return a list of(cars) for example do:

carList.addrange(MakeRedCars())
carList.addrange(MakeBlueCars())
for each car in carlist<br>
response.write(car.colour + "<r>")
next

I have implemented the answered below and with empty objects all works well, as soon as you hook in a database call that returns the data/objects studio does a JIT and crashes.

View 5 Replies

.net - How Many Threads Can Run Concurrently

Jan 28, 2011

I can only run "so many" threads concurretnly, a notion which I have seen elsewhere.As a threading novoice, how can I determine the maximum number of threads to use? Or is this a "how long is a piece of string" question? What does it depends on? Hardware config or what?

View 4 Replies

.net - Using GDI+ With Multiple Threads?

Apr 18, 2010

it would be best if I just copy and pasted the code (it's very trivial).

Private Sub Main() Handles MyBase.Shown
timer.Interval = 10
timer.Enabled = True
End Sub

[code]....

An exception, "The object is currently in use elsewhere", is raised during the tick event.

View 1 Replies

.NET Scheduling Threads?

Oct 25, 2010

I am having an issue where I need to implement a type of thread scheduling... I'm looking to implement a list of tasks, each with a set time that they need to execute, and after the time is up they will execute the respective code that goes with that task. I would use a timer based solution, however, I don't think that it would be very efficient. There will be a very large list of tasks, some of which need to be executed within seconds of being placed in the list.

View 1 Replies

Best List For 2 Threads?

Jun 10, 2010

I have 2 thread.One that put some data inside a list?the second that take out these data from the same list.what is the best "list" that allows one thread to put something inside and another one that take stuff out>

View 1 Replies

Get Rid Of Background Threads?

Nov 7, 2010

My application generates some background threads to perform some slow jobs (a cycle of ask for a long process to a server - wait - download the result).

View 5 Replies

How To Know All Threads Are Cancelled

Feb 25, 2009

I'm having a bit of an issue killing threads off and resetting my form. After starting the threads, everything runs fine. When I want to cancel the threads, the threads are all killed off "properly" using the Abortable Thread Pool, but how do I know that all the threads are dead? I've tried using both GetAvailableThreads and GetMinThreads compared against the thread count that should be running if they're all killed off, but I can't seem to get it to work. The only time I can get the GetAvailableThreads to return the "correct" number is if I freeze one thread and kill off the rest.

View 7 Replies

How To Merge 2 Threads

May 28, 2010

I have a GUI that is running for a form, let's call it Class xWindow. It has finished processing data and is simply waiting for the user to press a button, i.e. the main thread has nothing to do. Just before it finished processing, it kicked started something that has a callback function which occurs in a new thread (e.g. a system timer or a Bonjour callback to say that a service has been found on a port). This callback occurs within the xWindow class.

[Code]....

View 10 Replies

Keep Adding New Threads As Old Ones End?

Dec 22, 2010

Suppose I have created 70 "rule-finder" objects, and I want to run each one on data.This is a time-consuming process.The new computers with the I7 chip can run 7 processes in parallel, and so I was thinking of running 7 threads at a time. Asone thread ends, I would add another, until all 70 objects are used. When the last rule-finder has completed, I would resume the main course of the program.

View 5 Replies

Let Two Threads Communicate With Each Other

Jun 1, 2009

how can I let two threads communicate with each other by using VB.net?

View 3 Replies

Progress 'bar' Using Threads

Jan 25, 2010

I currently have a program that runs several "intense" queries. I added a textbox and presented status updates when a query was starting, eding and how many were left. This would suite my need, but the textbox doesn't actually display anything until all the queries are finished. It then displays all the updates at once. I'm assuming updating the textbox in another thread would solve this issue, and that is where I am lost. How can I use a thread that receives a message from the main form running the query and have it display it in the textbox?

View 4 Replies

Ran Into Some Threads Tlaking About XML?

Feb 25, 2009

I'm making a Tabbed Web Browser, and I need favorites to add to this web browser, I was searching this forum for answers on how to do it and I ran into some threads tlaking about XML and how they are easily controlled, yet a little more complex. How do I do this? Where do I start?

View 2 Replies

Threads In These Two Methods Different?

Jan 23, 2011

Take a look at the code below. Here I create a thread, set its name, and start it:

Private Sub fileCreated(sender As Object, e As FileSystemEventArgs)
Dim processFileThread As Thread = New Thread(AddressOf fileCreatedHelper)
processFileThread.Name = e.FullPath
processFileThread.Start()
End Sub

This is the sub that is the thread: Private Sub fileCreatedHelper()

[Code]...

View 2 Replies

Threads In Windows App?

Aug 17, 2011

I have a threading problem when it comes to updating the gui from the thread.

In my main function I have the following:

Private Sub StartThreads(Optional OrgName As String = "")

Dim blnMonitorEntered As Boolean = False

[Code]...

View 6 Replies

.net - Set CurrentPrincipal In Winforms For All Threads?

Jan 4, 2011

In a .NET 3.5 Winforms app, after a user provides a username and password, I set a custom principal in the CurrentPrincipal property like this:My.User.CurrentPrincipal = Service.GetPrincipal(username)This is done in a method that is called using Invoke, because the originating thread is not the UI thread:Invoke(New Action(AddressOf doLogin))But when I click on a button in the Winforms application, the CurrentPrincipal property has been reverted to its default, the current Windows user.Dim lPrincipal = My.User.CurrentPrincipal ' not my custom principalApparently, using Invoke while setting the principal does not solve the problem. Is there another way to set the CurrentPrincipal property for all threads in the application?

View 1 Replies







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