Solved

VB.Net Threading

Posted on 2010-09-04
4
315 Views
Last Modified: 2012-05-10
I have a threaded function like this:

Private Function Phone() As String
            Dim req As HttpWebRequest = WebRequest.Create("www.webserver.com/command.txt)
            Dim res As HttpWebResponse = req.GetResponse()
            Dim Stream As Stream = res.GetResponseStream()
            Dim sr As StreamReader = New StreamReader(Stream)
            Dim cmd As String = sr.ReadToEnd
            Select Case Command()
                Case Command.StartsWith(delete")
                    dim a as new filedelete class
                       a.delete
            End Select
            Return 0
        End Function

FileDelete is a class I made to delete a file. But when I call it from another thread, it doesn't work. Any help?
0
Comment
Question by:XGenwareS
  • 2
4 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 33606396
Can you post the filedelete class.
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 33607285
"doesn't work" as in what meaning? samples for success and failure would be very helpful along with the FileDelete class code - even if it's not complete but enough to sketch its main features, so we can suggest what's wrong with it.
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33609349
It seems you are doing something wrong, try the following code to call the function from another thread:

Call thread.Start() to start the thread.
Change 'functionName' with the function you want to use.
Private thread As New Threading.Thread(AddressOf functionName)



Private Sub functionName()

' TODO: Add your code here...

End Sub

Open in new window

0
 
LVL 12

Accepted Solution

by:
Mohamed Abowarda earned 500 total points
ID: 33609362
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
New to SOAP and need some direction 10 42
C# Json POSt to Rest API 4 35
Access to class from any project within a solution. 6 14
C# parent child form 5 14
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now