473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Threading

cj
I need more information to read about threading in Visual Basic.

Hopefully something linear w/o too many links to get lost in. I've been
to
http://msdn.microsoft.com/library/de...nThreading.asp
but it is too confusing. I can't find any references to STA threading
model or what exactly this is doing:

<STAThread()> Public Shared Sub Main(ByVal CmdArgs() As String)
Application.Run (New Form1)
End Sub

Thanks
Feb 8 '06 #1
8 3805
cj,

Are you sure you need threading, as I have read from somebody active in this
newsgroup and full acknowledged by me, who wrote something as.

Multi threading is mostly in use by newbies who find it very interesting
however don't know what to solve with it.

Be aware that multithreading takes forever more processing time.

Therefore start reading it when you need it, beside the more processing time
makes it your program less maintainable.

However if you want to read something about it, than start with the
backgroundworke r from version 2.0 which has at least not to much from the
last problem.

http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx

I hope this gives an idea.

Cor
Feb 9 '06 #2
CMM
To complement Cor's post.... If you're coming from the VB.Classic world and
need to understand threading in relation to VB.Classic's and COM's threading
models, start here:
http://blogs.msdn.com/jfoscoding/arc...07/406341.aspx
Then
http://www.devx.com/DevX/10MinuteSolution/20365

I can give you a canned response about what Application.Run does, but this
will be more informative:
http://dotnet.sys-con.com/read/39039.htm

--
-C. Moya
www.cmoya.com
"cj" <cj@nospam.nosp am> wrote in message
news:em******** ******@TK2MSFTN GP12.phx.gbl...
I need more information to read about threading in Visual Basic.

Hopefully something linear w/o too many links to get lost in. I've been
to
http://msdn.microsoft.com/library/de...nThreading.asp
but it is too confusing. I can't find any references to STA threading
model or what exactly this is doing:

<STAThread()> Public Shared Sub Main(ByVal CmdArgs() As String)
Application.Run (New Form1)
End Sub

Thanks

Feb 9 '06 #3
cj
Cor, I would not be using threading unless I thought I had to. The
company we purchased the com components from has told me that I have to
use threading to make a TCP/IP server capable of handling many requests
simultaneously. Sounds logical to me too. I'm trying to understand
their sample programs.
Cor Ligthert [MVP] wrote:
cj,

Are you sure you need threading, as I have read from somebody active in this
newsgroup and full acknowledged by me, who wrote something as.

Multi threading is mostly in use by newbies who find it very interesting
however don't know what to solve with it.

Be aware that multithreading takes forever more processing time.

Therefore start reading it when you need it, beside the more processing time
makes it your program less maintainable.

However if you want to read something about it, than start with the
backgroundworke r from version 2.0 which has at least not to much from the
last problem.

http://msdn2.microsoft.com/en-us/library/8xs8549b.aspx

I hope this gives an idea.

Cor

Feb 9 '06 #4
cj
yes and no, I'm coming from VB4 but have never touched threading
before. Thanks for the links. I'll look at them today.

CMM wrote:
To complement Cor's post.... If you're coming from the VB.Classic world and
need to understand threading in relation to VB.Classic's and COM's threading
models, start here:
http://blogs.msdn.com/jfoscoding/arc...07/406341.aspx
Then
http://www.devx.com/DevX/10MinuteSolution/20365

I can give you a canned response about what Application.Run does, but this
will be more informative:
http://dotnet.sys-con.com/read/39039.htm

Feb 9 '06 #5
CJ,

Than I would ask the question more direct on TCP/IP, this subject is already
often handled in this newsgroup by the way.

http://groups.google.com/group/micro...rch+this+group

You can as well have a look at Jon's pages. However because I have read your
question, is my opinion that I think that you will not become happy from
this.

http://www.yoda.arachsys.com/csharp/threads/

Be aware that it is not as difficult as it looks like as you have seen these
pages.

I hope this helps,

Cor
Feb 9 '06 #6
cj
I'd found the DevX one yesterday. Unfortunately both are in C. Because
of that I couldn't quite figure out how it related to some sample VB.Net
code I have that uses multi-threading.

http://dotnet.sys-con.com/read/39039.htm I didn't understand.

I'm beginning to wonder if I should dump vb.net and start using C++ or
C#. :) It seems most examples are in C something.
cj wrote:
yes and no, I'm coming from VB4 but have never touched threading
before. Thanks for the links. I'll look at them today.

CMM wrote:
To complement Cor's post.... If you're coming from the VB.Classic
world and need to understand threading in relation to VB.Classic's and
COM's threading models, start here:
http://blogs.msdn.com/jfoscoding/arc...07/406341.aspx
Then
http://www.devx.com/DevX/10MinuteSolution/20365

I can give you a canned response about what Application.Run does, but
this will be more informative:
http://dotnet.sys-con.com/read/39039.htm

Feb 9 '06 #7
cj,

I agree with you that it seems that almost everything written about threads
is done in a difficult way.

The problem with those two Microsoft samples is that they are good, however
seems to be made in an hour and than even direct translated from C#. They
are in my opinion both more confusing for me than educating.

I don't expect because of the new backgroundworke r, that there will me much
more samples in feature using raw threading.

However multithreading is much simpler than you think in fact if there
(writing this message I saw the samples are even there)

Create a thread
Tell at which method it should start
Start it.

All written here
http://msdn2.microsoft.com/en-us/lib...ng.thread.aspx

Than you have to sent normally (if you don't do it in some of the foolish
ways I have seen here) the information from the worker thread to the main
thread, what goes assynchone and therefore you need an assynchronous method.
For that is the Queue class an ultimate solution.

http://msdn2.microsoft.com/en-us/lib...ons.queue.aspx

However because that there can be problems when one thread is unloading it
(in your case your main thread) and the worker thread is filling it (there
happens than two things in the same time), therefore you have to synclock it
before you unload or/and load it, which means that all actions are stopped
until the thread who has synclocked it gives it free again (end synclock).
This means that you should not use this not needed and only for that for
what it is needed.

http://msdn.microsoft.com/library/de...tmsynclock.asp

About your sentence for samples in C#, the C# developers have the same
problem, they tell that all samples are writen for VB.Net. :-)

I hope this helps,

Cor

"cj" <cj@nospam.nosp am> schreef in bericht
news:OD******** *****@TK2MSFTNG P12.phx.gbl...
I'd found the DevX one yesterday. Unfortunately both are in C. Because
of that I couldn't quite figure out how it related to some sample VB.Net
code I have that uses multi-threading.

http://dotnet.sys-con.com/read/39039.htm I didn't understand.

I'm beginning to wonder if I should dump vb.net and start using C++ or C#.
:) It seems most examples are in C something.
cj wrote:
yes and no, I'm coming from VB4 but have never touched threading before.
Thanks for the links. I'll look at them today.

CMM wrote:
To complement Cor's post.... If you're coming from the VB.Classic world
and need to understand threading in relation to VB.Classic's and COM's
threading models, start here:
http://blogs.msdn.com/jfoscoding/arc...07/406341.aspx
Then
http://www.devx.com/DevX/10MinuteSolution/20365

I can give you a canned response about what Application.Run does, but
this will be more informative:
http://dotnet.sys-con.com/read/39039.htm

Feb 9 '06 #8
cj
Correction: I got the DevX one you sent me confused with another one.
The one you sent me is very good. Thanks!

cj wrote:
I'd found the DevX one yesterday. Unfortunately both are in C. Because
of that I couldn't quite figure out how it related to some sample VB.Net
code I have that uses multi-threading.

http://dotnet.sys-con.com/read/39039.htm I didn't understand.

I'm beginning to wonder if I should dump vb.net and start using C++ or
C#. :) It seems most examples are in C something.
cj wrote:
yes and no, I'm coming from VB4 but have never touched threading
before. Thanks for the links. I'll look at them today.

CMM wrote:
To complement Cor's post.... If you're coming from the VB.Classic
world and need to understand threading in relation to VB.Classic's
and COM's threading models, start here:
http://blogs.msdn.com/jfoscoding/arc...07/406341.aspx
Then
http://www.devx.com/DevX/10MinuteSolution/20365

I can give you a canned response about what Application.Run does, but
this will be more informative:
http://dotnet.sys-con.com/read/39039.htm

Feb 9 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
6725
by: Anthony_Barker | last post by:
I have been reading a book about the evolution of the Basic programming language. The author states that Basic - particularly Microsoft's version is full of compromises which crept in along the language's 30+ year evolution. What to you think python largest compromises are? The three that come to my mind are significant whitespace, dynamic typing, and that it is interpreted - not compiled. These three put python under fire and cause...
2
2972
by: Egor Bolonev | last post by:
hi all my program terminates with error i dont know why it tells 'TypeError: run() takes exactly 1 argument (10 given)' =program==================== import os, os.path, threading, sys def get_all_files(path): """return all files of folder path, scan with subfolders
77
5259
by: Jon Skeet [C# MVP] | last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the article on all the groups this is posted to. I've finally managed to finish my article on multi-threading - at least for the moment. I'd be *very* grateful if people with any interest in multi-threading would read it (even just bits of it - it's somewhat long to go through the whole thing!) to check for accuracy, effectiveness of examples, etc. Feel free to mail...
6
555
by: CK | last post by:
I have the following code in a windows service, when I start the windows service process1 and process2 work fine , but final process (3) doesnt get called. i stop and restart the windows service and the final process(3) gets called. what am I doing wrong with the threading? by the way Directory.GetFiles(IncomingXMLPath1).Length is some global outcome from process 1. Thanks 1)
2
2242
by: Vjay77 | last post by:
In this code: Private Sub downloadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) If Not (Me.downloadUrlTextBox.Text = "") Then Me.outputGroupBox.Enabled = True Me.bytesDownloadedTextBox.Text = "" Me.totalBytesTextBox.Text = ""
11
5014
by: Paul Sijben | last post by:
I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found that the UDP communication is my biggest drain on performance! Communication where the client and the server are on the same machine still takes 300ms or sometimes much more per packet on an Athlon64 3000+ running Linux (Fedora Core 5 x64). I must...
17
6408
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. Note, the Windows task manager shows 2 CPUs on the Performance tab with hyper-threading is turned on. Both Python 2.3.5 and 2.4.3 (downloaded from python.org) have this problem. The operating system is MS Windows XP Professional.
0
1584
by: kingcrowbar.list | last post by:
Hello Everyone I have been playing a little with pyGTK and threading to come up with simple alert dialog which plays a sound in the background. The need for threading came when in the first version i made, the gui would freeze after clicking the close button until pygame finished playing the sound. In Windows it was acceptable because it could be ignored easily, but in
7
2367
by: Mike P | last post by:
I am trying to write my first program using threading..basically I am moving messages from an Outlook inbox and want to show the user where the process is up to without having to wait until it has finished. I am trying to follow this example : http://www.codeproject.com/cs/miscctrl/progressdialog.asp But although the messages still get moved, the progress window never does anything. Here is my code in full, if anybody who knows...
126
6682
by: Dann Corbit | last post by:
Rather than create a new way of doing things: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html why not just pick up ACE into the existing standard: http://www.cse.wustl.edu/~schmidt/ACE.html the same way that the STL (and subsequently BOOST) have been subsumed? Since it already runs on zillions of platforms, they have obviously worked most of the kinks out of the generalized threading and processes idea (along with many...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.