Solved

VB.Net Threading

Posted on 2010-09-04
4
305 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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