Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Visual Basic Help

  • 27-09-2010 03:54PM
    #1
    Registered Users, Registered Users 2 Posts: 82 ✭✭


    I need to make a programme with constantly changing image files. The files in question will be located on the C drive. Not sure where to begin with this, I'm not too familiar with VB. So far I'm going along the lines of having a timer with the code

    Dim s1 As String = "c:\temp\image"
    Dim s2 As String = ".bmp"
    Dim num As Integer = (i) ' construct file name by concatenating 3 things

    pbxDisp.Image = Image.FromFile("s1 & num & s2")

    I want to increment the image number by one each time but am completely lost!!!


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Dim s1 As String = "c:\temp\image"
     Dim s2 As String = ".bmp"
    Dim num As Integer = (i)                        ' construct file name by concatenating 3 things
    do while num <= 10         
        pbxDisp.Image = Image.FromFile("s1" & num & "s2")
        num = num + 1
    loop
    
    

    Will loop up to 10.


  • Registered Users, Registered Users 2 Posts: 1,430 ✭✭✭Merrion


    You don't need the quotes in:
    pbxDisp.Image = Image.FromFile("s1" & num & "s2")
    

    should be
    pbxDisp.Image = Image.FromFile(s1 & num & s2)
    


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    this sounds like home work.

    though there were rules on providing solutions?


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    amen wrote: »
    this sounds like home work.

    though there were rules on providing solutions?

    The rules are basically explain you're problem and provide some code. The OP did both.


Advertisement