VS 2005 - Multithreading - How Are Threads Accessing The Sub

Oct 15, 2010

I have 10 threads each using the same sub to do work. This sub is calling a function to save the results. How are the threads accessing the sub? Is each one getting a fresh copy of the sub to do its thing or are they using the same piece of code and need to wait for each other to finish processing? I don't get any hits when searching for such a specific scenario. I am wondering because it is about using sockets (usually lightweight stuff) to retrieve a resource and the cpu is working at 100% all the time. Still it is very fast, 900 internet queries finish in about 3 minutes.

View 4 Replies


ADVERTISEMENT

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

Add Two Numbers Up Using Threads Or Multithreading?

Jun 16, 2012

My question is to add two numbers up using threads or multithreading. Here is what I have:

Module Module1
Sub ThreadA()
Dim I As Integer[code].....

Is there a way I can use this somehow to add two numbers up?

View 1 Replies

Multithreading - Code For Running Multiple Threads?

Apr 17, 2010

How to I run multiple threads in VB.NET? Say I need 2 threads - one that prints 100 numbers in a loop and the second one that asks for the user's name and prints it inside a message box.

View 1 Replies

Multithreading - Speed Up Loop Through Additional Threads?

Dec 27, 2010

I have problem with multithreading.

For:

Code:

and multithreading to loop for:

Code:

How can I speed up this loop through additional threads?

I tried:

Code:

How can I do?

View 10 Replies

VB - Multithreading With Synclock - Threads With Different Sessions Run Trylock Simultaneously

Jan 31, 2011

i have some test code which i run at every load of a page in my asp.net website [Code] the "dotrace" simply add a record to a log table in the db. now the right result would be that i should have the entries in the db in order "entered","exiting","exited" but actually when i look in the db i see first 2 "entered" then 2 "exiting" etc. meaning that the multi-threading is working ok, but not the synclock. is that correct?

and how can this be fixed? the real code will be adding records to the db and might be called from several pages of different sessions, but the same code must not run twice concurrently. if i open multiple pages at once, they still clash some times. but if i'm correct, the issue is now not with the synclock as much as with the httpruntime.cache, because when using a standard property, on one page, the code works 100%. so how can i make sure that 2 threads, even from totally different sessions never run the trylock simultaneously?

View 1 Replies

.net - Multithreading Function To Implement Threads Fetching From A List Of Urls To Parse Content?

Feb 2, 2010

I have the following multithreading function to implement threads fetching from a list of urls to parse content. The code was suggested by a user and I just want to know if this is an efficient way of implementing what I need to do. I am running the code now and getting errors on all functions that worked fine doing single thread.for example now for the list that I use to check visited urls; I am getting the 'argumentoutofrangeexception - capacity was less than the current size'/Does everything now need to be synchronized?

Dim startwatch As New Stopwatch
Dim elapsedTime As Long = 0
Dim urlCompleteList As String = String.Empty

[code]...

View 2 Replies

Multithreading Accessing A Dataset From Within A Threaded Class Instance?

Nov 1, 2011

I was using the following code within a class and creating an instance of that class from within my main form (Main.vb):Dim count As Integer = Main.DbDataSet.Accounts.CountThis was returning the count of accounts within my database.After changing the code so that I could run this in a background thread to save locking up the program, as more data is processed after this point, the count was returning 0 each time.

View 1 Replies

VS 2010 : Multithreading And Accessing Other Routines/form Properties?

Mar 1, 2011

I'm writing a really simple file updater which downloads files off from a website and saves them. The download routine is working well, except that it freezes the project while attempting to connect to the host. Easily solved with threading except now when I try to access other form items such as text boxes, labels, form caption, it says I am not doing it in a safe manner and prompts an interrupt in debug. I did some reading on it and I'm still not sure what to do, I'm very new to vbnet and it is still a little confusing to me.

Error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.
Imports System.Threading
Imports System.Net
Imports System.IO

[code]....

View 8 Replies

Accessing Labels From Different Forms&threads

Feb 5, 2009

Recently i was trying to access the labels of main form (Form1) from a thread that was running on the other form (Form2), and I have noticed, that the label.Text is not changing.Form1 code - after the main Form is loaded I launch the second Formular, and the method on it : [code]There is a sample code attached to show how is it working.Is there any possibility to change the label values on the Main window?Peter.

View 2 Replies

Use Multithreading With VB 2005?

Nov 13, 2009

I try to use Multithreading with VB 2005. I added a Listbox to main form and i tried to fill ListBox with 2 threads. When i executed code it told me that this is unsafety operation becasuse of ListBox is created with Main(Form1) form.

Is there anybody who has such simple multithreading example with Mutex or such lock mechanism?

View 1 Replies

Multithreading - Me.Invoke Doesn't "Invoke" - Threads Stall On Invoke Statement

Mar 16, 2010

I've got the following code:

[code]...

The problem is that, when I call the "SetStatusBarText" sub from another thread, InvokeRequired is True (as it should be), but then my threads stall on the Me.Invoke statement - pausing execution shows them all just sitting there, not actually invoking anything.

View 1 Replies

VS 2005 Converting Class To Use Threads?

Mar 29, 2010

I have a class that includes a timer :-

public class clsQueryObject
private tmrPoll as new timer
Public sub New()

[code]....

View 3 Replies

VS 2005 Pause A Thread - Let Other Threads Run

Dec 5, 2010

In my application I have a loop that makes calls to a website to download data. I'm using a DownloadDataAsynch call with a handler.

I'm making many such calls in a loop. What I'd like to do is, if I have more than a certain number of replies pending, I should pause the loop and let the data handlers run.

How do I do that?

CODE:

View 14 Replies

Communications :: Involving Cross Threads In .NET 2005?

Feb 8, 2010

My application need to communicate with my self made device through serial port. I have to change the selected index of Tabs when I press a button on my device. I have Form1, Form2, Module1 Form1 Contains the Serial Port Control. Form2 contains the Tab which needs to be changed. When I press a button on device them, the button pressed is stored in an integer form in a global variable.The Interrupt for the Serial Port directs the control to the module1 where I decide using Select Case that what index of which TabControl I have to select.Depending on that, I change the Index of the required Tab.

PROBLEM:cross thread exception is fired as soon as the control reaches the statement where I Modify the SelectIndex property from the select case at Module1.While, on my other PC, the SelectIndex property is changed, but the next tab is not shown.

BUT, if I put all this code in a button control, and try to activate from there, then it works perfectly. However, I have to navigate through the tab controls using my self made device.I searched a lot on net and came across a solution which describes that we have to use delegate function and invokeRequired methods to ensure that the procedures run on the same thread.I am not able to decide that where exactly shoud the code for delegates and all be written, in form1, or form2, or module1.Also, in the hit and try that I did, I always got the value of InvoleRequired as False.

Here is the part of Code that I wrote for Delegates

Code:

'Form 1 is BLINDHELPER_SIGNIN
'form 2 is BLINDHELPER_USER

' I have defined these at Module1

Public Delegate Sub DeleToManageTabs(ByVal tb As TabControl)
Public Sub manage_Tabs(ByVal tab As TabControl)
MsgBox(tab.Name)

[code]....

After using this code also, there is no change in working of my application.

View 3 Replies

[2005] SyncLock And Multithreading - Public Class Utilities With A Many Shared Functions

Feb 11, 2009

I am trying to get a handle on SyncLock and multithreading, but I am having some trouble wrapping my head around exactly how it should be implemented. I have a Public Class Utilities with a many Shared Functions. I want to make sure that each function can only be executed when there are no other concurrent calls to the same function. So If I have 2 functions, A and B in a Public Class Utilities, what is the syntax so that a function "locks" while it is being executed, preventing any subsequent calls until the "locking" thread has completed?

CODE

Public Class Utilities

Public Shared Function A (ByRef i As Integer) As Integer

[CODE].............................

I know I need to wrap the statements of execution in a SyncLock block, but I am unsure of the scope of the parameter used with SyncLock...is it private to the function, class, etc? Can the same object be used to lock both functions if they are independent?

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

Accessing Excel Within .net (2005)?

Mar 9, 2010

What i would like to do is change the color of a column in excel. I cannot seem to get the right command string to accomplish it.

View 2 Replies

VS 2005 Accessing A Database?

Dec 12, 2010

I'm having some issues with a game I've been writing for several years. It's an on/off project and recently I purchased a new computer and formatted my old computer so all of my installations of windows and visual basic 2005 (express edition) are fresh. I'm getting the following error:

View 11 Replies

VS 2005 Accessing A USB COM Port?

Nov 17, 2011

I have am using an XBee ZigBee wireless module to communicate with a project of mine. I currently have it set up to the point where I can open a hyperterminal session to COM 4 (which is the usb com port), and recieve the data that is being sent via the microcontroller on the other side of the wireless link.

I would like to make an app that takes the data and puts it in to a more user-readable format. (Via VB 2005) So far all I have come up with is some problems. It doesn't seem like I can use the built in serial port tool to access a "virtual" com port. From the following link:Quote:

Note You cannot use the Microsoft .NET Framework classes to directly access other types of ports, such as parallel ports or USB ports.[URL]..Do I have to use a "COM port redirector" to make it seem like a real COM port? Or is there some easy way that I am not thinking of?

View 1 Replies

Accessing Data Without Using Database (.Net 2005)

Jan 31, 2010

Is it possible to add, edit, view and delete records using a file only (instead of a database) and .Net 2005 (VB.Net/C#)? The concept is that a file that'll work more-or-less like a database. One can add, edit, view, delete and query data to and from the file. The file, either cannot be opened directly or data inside the file should be in some encrypted form so that even if the file is opened no one can comprehend it. Data inside the file can only be manipulated by a front end application i.e. .Net 2005.

View 1 Replies

VS 2005 Accessing SqlDataSource In Code Behind?

Apr 21, 2010

I am trying to programatically use my SQLdatasource in my code behind so that I can select a certain field from a table based on the selectedindexchange event of a listbox control on my form. I have one datasource already set to the listbox control but i want a seperate datasource to select a field based on the value of the listbox. I declared a new datasource sqlDataSource2, set the connectionstring to the same database/table and i have the following line set for the select statement

View 1 Replies

[2005] Accessing Device On USB Port?

Nov 10, 2008

I have been doing some research into accessing devices on a USB port and it's kind of helped, but not really. From what I understand, I can use the IO.Port namespace to access a device on a USB port (usually). Let me know if this is incorrect.

First, I made a simple program that looped through the ports available. I get COM1 and COM3, but I have 4 USB ports. Where are the others?

My
Dim comm As New List(Of IO.Ports.SerialPort) 'list of comm ports
For Each PNstr As String In IO.Ports.SerialPort.GetPortNames() 'get a list of Com Port Names

[Code].....

View 13 Replies

VS 2005 Accessing A Remote Access Database?

Jul 14, 2009

I have an issue with am access database source located on a remote computer.I tried using ADODB to access it, it works, but when I change( update insert or delete) the database on the remote computer, the changes is not reflected in my application

View 1 Replies

VS 2005 Accessing Data Connections On Form2 And Other Sub's

Oct 11, 2009

I have a small databse program. Form1 uses the Private Sub OpenToolstripmenu to Openfiledialog box and creates a connection and adapters. I need a second form that will access the same connections and adpaters what is the best /correct way to do this? Also other sub functions on form1

View 8 Replies

VS 2005 Accessing Stored Data On Serial?

Feb 15, 2011

My problem is that i have a usb-to-serial device which creates a virtual serial port ( Com 4 for example )on the computer i need to connect to it and get the data stored on it I already have worked out how to use the System.io.ports to connect to the port ( baud rate, stop bits, parity ,ect) and it connects to the usb fine. But once the connection is open i don't know how to retrieve the data. Everything i have tried relies on events. But as the usb does not send data i don't know how to access the serials memory.

View 3 Replies

[2005] Accessing Sytem Tray Icons?

Jan 8, 2009

"Getting a list of system tray icons/programs has been a thorn in my side for the past year can get the list as long as explorer is running, but the second explorer is closed, the list will not populate. I'm frustrated beyond belief that I can't find the proper API calls to get the information. If anyone knows how to do this, PLEASE share it here!! I know it is possible, because other shells do it. -Ray"

View 9 Replies

[2005] UnauthorizedAccessException Accessing Comm Port

May 3, 2006

I'm debugging a VB app where I'm using a comm port attached to a bluetooth radio paired to another bluetooth radio in order to communicate with a remote barcode scanner. The pair of bluetoooth devices basically work as a serial cable replacement. Sometimes it works fine, but after a while I get an UnauthorizedAccessException message which breaks the program (see attached jpeg).

I only get this when I use the radios and not when I use a direct cable. I wonder if it has something to do with other bluetooth devices nearby trying to communicate with mine. I've used the .NET Framework 2.0 Confuration tool to adjust the zone security to give full trust to MyComputer, so I don't think it has to do with security, but I'm really going beyond my area of expertise here. I don't know what's going on.

[Code]...

View 2 Replies

VS 2005 Accessing The Controls Of Multiple Data Window(mdw) Forms

Oct 21, 2009

I have to make some automatization on a web server, I use Visual Studio 2005 Visual Basic Windows Console Application. I want to make a load/performance test of the web server, so I open several Internet Explorer instances, and I login the application, that is not a problem. But after that I have a mess on the page and I cannot make any more automatization...The composition of the page after the login is like this: I have the default form, another form and a multiple data window(mdw) controller, which dinamically can switches the forms on this part.

The problem is that I don't know how to access the controls of this mdw forms. I couldn't find much about this mdw controller and I am not an expert.

My code is here:

Imports System
Imports System.Diagnostics
Imports System.Web.Ui.Webcontrols

[Code].....

View 5 Replies

Accessing Word Tables Created In Word Templates / Accessing Existing Bookmarks In Word Templates?

Jun 30, 2010

Basically in visual basic 6 I could access word tables in existing templates with the code owordactivedoc.tables(1).select() where owordactivedoc refers to the active word document and tables(1) refers to the first table in the template.Trying the same code in VB 2003 just leads to errors. Secondly how do I access bookmarks or alternatively word variables.Furthermore how do one deploy web.services. For example the current program I am building is for another computer. Simply copying the web service to Inetpubwwwroot dont work because it is not picked up by the Internet Information Services program. I have to create the web service in vb2003 on the other computer change msconfig manually. Copy and paste the existing service vb file in the created folder replacing the empty vb file.

View 3 Replies







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