Results 1 to 9 of 9

Thread: Listbox Items And Images

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    64

    Listbox Items And Images

    I've decided to edit this thread as its pretty complicated to understand my problem in the way i've worded it.

    I want to make an application that's pretty much all server side.
    I have everything sorted, apart from downloading images from my server.

    I have a listbox containing all the game names, in this format.

    Code:
    pacman
    rallyx
    mspacman
    asteroids
    There are many more, thats just an example.

    Each game name is stored as a folder on my server. Inside those folders is the games boxart, called boxart.png

    What i want to do is make an application that makes those folders and downloads the images.

    I have made the "create a folder for each game name" code already, now i just need to add another line or two to download the image inside those created folders.

    Code:
       
            For x As Integer = 0 To ListBox1.Items.Count - 1
                My.Computer.FileSystem.CreateDirectory("C:\Users\Joel\Desktop\ids\" + ListBox1.Items(x).ToString)
    next
    Could anyone help me with this ??

    I would greatly appreciate the help as it seems a simple task but i'm having trouble with it.
    Last edited by JJMPSP; May 9th, 2010 at 06:51 AM. Reason: reworded problem

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: Make a folder with a downloaded image inside it ?

    What is the format of the listbox items?

    Perhaps that could give us an indication of what is wrong...
    VB.NET MVP 2008 - Present

  3. #3
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Make a folder with a downloaded image inside it ?

    P.S. You should Close and Dispose the StreamWriter.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    64

    Re: Make a folder with a downloaded image inside it ?

    Sorry guys, i have been away for a couple of days, back now though
    Want I want to do is make a folder for each item in the listbox and also download an image into those created folders.

    the format of the listbox is :

    584109B7
    584109A8
    584108AA
    58410975

    so an id per line.
    each downloaded image should be saved from the picturebox on the form.

    Hope this explains the problem in more detail .

    Thanks

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    64

    Re: Make a folder with a downloaded image inside it ?

    Anybody know a code then ?
    I dont want to do it manually, it will take ages

  6. #6
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: Make a folder with a downloaded image inside it ?

    maybe if you provided the info of where the picture is being downloaded from etc... someone may help a bit sooner ( i know you say there's a picturebox, but when you click the list does it point to loading an image from somewhere on a pc? from a website? )
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    64

    Re: Make a folder with a downloaded image inside it ?

    oh what an idiot i am, i never thought of that.

    picturebox1 get its image from a url from the internet.
    codeview:

    picturebox1.imagelocation = " http://www.jtagxbox360.info /" & listbox1.selecteditem & "boxart.png"
    so each item is unique by its id, I have already made the folders on my server and uploaded the boxart for each game. Now i want a user to click a button and download each boaxart into its own folder (listbox1.selecteditem in this case)
    I made a code for making folders as I said, but now I just need the images to save to those unique folders.
    Lol its pretty hard to explain, i hope you understand.

    Many thanks for reading.
    Last edited by JJMPSP; May 8th, 2010 at 01:09 PM.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2010
    Posts
    64

    Re: Listbox Items And Images

    i just updated the first post so its easier for people to understand my problem.

  9. #9
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Listbox Items And Images

    Call DownloadImage() when the button is clicked:
    Code:
    Private Sub DownloadImage()
         If Me.ListBox1.SelectedIndex = -1 Then Exit Sub
         Dim s As String = DirectCast(Me.ListBox1.SelectedItem,String)
         Using wc As New Net.WebClient()
              wc.DownloadFile("http://www.jtagxbox360.info/" & s & "/boxart.png",s & "_boxart.png")
         End Using
    End Sub

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