Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / April 2006

Tip: Looking for answers? Try searching our database.

VB.Net Create a new thread

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ron Weiner - 27 Apr 2006 15:02 GMT
I would like to start a print job running on its own thread in order to give
control back to the user as soon as possible.  I have created a sub
PrintOneRecord(intRecordID) that does the deed.  I thought I could start the
print job running on its own thread by coding something like this:

Dim MyThread As New System.Threading.Thread(AddressOf
PrintOneRecord(intRecordID))
MyThread.Priority = Threading.ThreadPriority.BelowNormal
MyThread.Start()

But this give an error in the editor "AddressOf operator must be the name of
a method; no parentheses are needed"

Changing it to:

Dim MyThread As New System.Threading.Thread(AddressOf PrintOneRecord)
MyThread.Priority = Threading.ThreadPriority.BelowNormal
MyThread.Start()

Gives an even better error message "Method 'Public Sub
PrintOneRecord(intDatID as Integer)' does not have the same signature as
delegate 'Delegate Sub Thread start'."

Can some one help me sort this out.  All I want to do is to start a new
thread running the Sub PrintOneRecord and pass it the RecordID that needs to
get printed.

Signature

Ron W
www.WorksRite.com

<ctacke/> - 27 Apr 2006 15:17 GMT
A thread proc must be defined as Sub MyProc() so no parameters are allowed,
which is what the compiler is telling you.

-Chris

>I would like to start a print job running on its own thread in order to
>give
[quoted text clipped - 26 lines]
> to
> get printed.
Ron Weiner - 28 Apr 2006 15:36 GMT
Thanks Chris.
I got around this by pointing the thread to a new Sub that calls the the
PrintOneRecord sub with the appropriate prameter.  It all seems to be
working OK.

Signature

Ron W
www.WorksRite.com

> A thread proc must be defined as Sub MyProc() so no parameters are allowed,
> which is what the compiler is telling you.
[quoted text clipped - 31 lines]
> > to
> > get printed.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.