another question.....comon reply with annnnyyything!
I'm in the process of designing a program and i know ive asked alot of questions on here as of late...but thats the best way to learn....so could i atleast get an "I don't know" or something out of u guyz....
how do u close a file that has been downloaded with the system.net.webclient.downloadfile function? ... i keep getting an error and ive tracked it to the point that i think its because this function isnt closing the file when done downloading....caaannn annnyyy1 help?..thx in advance to all that post
Private Sub TB_Get_Word_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B_Get_Word.Click
GB_Word.BringToFront()
WordImageURL = Nothing
secWord = Nothing
secData = Nothing
Dim GetWordPageStream As New System.Net.WebClient()
Dim StreamReader(999) As Byte
Dim GetWordPage As String
Dim NewWordUrl As String = Nothing
Dim WordStartPos1 As Integer
Dim WordStartPos2 As Integer
StreamReader = GetWordPageStream.DownloadData("http://edit.yahoo.com/config/register?wtoken=")
GetWordPage &= System.Text.Encoding.ASCII.GetString(StreamReader)
TextBox1.Text = GetWordPage
WordStartPos1 = FindMyText("http://reg.yimg.com/i/", 1)
WordStartPos2 = FindMyText(".jpg", 1)
NewWordUrl = GetWordPage.Substring(WordStartPos1, WordStartPos2 - WordStartPos1 + "4")
secData = NewWordUrl.Substring(0, WordStartPos2 - WordStartPos1)
secData = secData.Remove(0, 22)
GetWordPageStream.DownloadFile(NewWordUrl, Application.ExecutablePath & "imageword.jpg")
PB_Word.Image = PB_Word.Image.FromFile(Application.ExecutablePath & "imageword.jpg")
NewWordUrl = Nothing
GB_Word.Enabled = True
Exit Sub
errorhandler: Select Case Err.Number
Case 5
MsgBox("Connection Error.", MsgBoxStyle.Critical, "")
Case Is <> 5
MsgBox(Err.Description, MsgBoxStyle.Critical, "Error #" & Err.Number)
End Select
End Sub
the problem comes when i try to click the button a second time....gives me a WebSomething error....searched for the error, its a download error...doesnt give details...so i desided to try to delete the file after used in the picturebox but it says its inuse by another process.....so do i need to clear the picture box before i redownload.....well that just hit me like a ton of bricks....let me try that...