Results 1 to 8 of 8

Thread: another question.....comon reply with annnnyyything!

  1. #1

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196

    Unhappy 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

    AcE

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    See if this ganna help !

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Either that or post your code.

  4. #4

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196
    Code:
    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
    theres the problem area....

  5. #5

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196
    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...

    AcE.....i'll brb....

  6. #6

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196
    hmmm....all i c that could work here is the .dispose function for the picture box....any1 know how to just set the picturebox's image back to (none) ?

    im going to bed...will check this when i get up...nighty night all....

    AcE

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    to reset picturebox do this :
    VB Code:
    1. PictureBox1.Image = Nothing

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Here's an example of downloading picture , maybe you profit from it !
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width