7 Replies - 1226 Views - Last Post: 01 January 2011 - 08:29 PM Rate Topic: -----

#1 jhaze2435  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 26-September 10

Images in vb.net

Posted 01 January 2011 - 07:14 PM

Can someone please help me ......How can I scroll through images in vb.net. I have 5 pictures saves to my resources but I can also see 2. How can i advance through the pictures and show a description of each? I also have a timer but I am not sure how to enable it during run time. Is that my problem?
Is This A Good Question/Topic? 0
  • +

Replies To: Images in vb.net

#2 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,010
  • Joined: 02-July 08

Re: Images in vb.net

Posted 01 January 2011 - 07:26 PM

You could load them into a List(Of Image) and with the timer just advance thru the list by index. To enable a timer you use .Enabled = True and the tick event will fire at the desired interval which is milli-seconds.
Was This Post Helpful? 0
  • +
  • -

#3 jhaze2435  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 26-September 10

Re: Images in vb.net

Posted 01 January 2011 - 07:31 PM

View Posthawkvalley1, on 01 January 2011 - 06:26 PM, said:

You could load them into a List(Of Image) and with the timer just advance thru the list by index. To enable a timer you use .Enabled = True and the tick event will fire at the desired interval which is milli-seconds.


View Posthawkvalley1, on 01 January 2011 - 06:26 PM, said:

You could load them into a List(Of Image) and with the timer just advance thru the list by index. To enable a timer you use .Enabled = True and the tick event will fire at the desired interval which is milli-seconds.



I've loaded them into a list on my resources and I ahve the timer that si set to 200 milli-second and I have the timer property set to enable but it is only advancing once and how do I add a description to the image
Was This Post Helpful? 0
  • +
  • -

#4 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,010
  • Joined: 02-July 08

Re: Images in vb.net

Posted 01 January 2011 - 07:42 PM

Show us your code, that is the way to get help here, you must show some initiative.
Was This Post Helpful? 0
  • +
  • -

#5 jhaze2435  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 26-September 10

Re: Images in vb.net

Posted 01 January 2011 - 08:04 PM

View Posthawkvalley1, on 01 January 2011 - 06:26 PM, said:

You could load them into a List(Of Image) and with the timer just advance thru the list by index. To enable a timer you use .Enabled = True and the tick event will fire at the desired interval which is milli-seconds.


View Posthawkvalley1, on 01 January 2011 - 06:42 PM, said:

Show us your code, that is the way to get help here, you must show some initiative.


Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSpeed.Tick
        Dim intCounter As Integer

        Select Case intCounter
            Case 0
                Me.picChicagoBears.Image = My.Resources.Brian_urlacker

            Case 1
                Me.picChicagoBears.Image = My.Resources.Jay_Cutler

            Case 2
                Me.picChicagoBears.Image = My.Resources.Devin_hester_again

            Case 3
                Me.picChicagoBears.Image = My.Resources.Devin_Hester
            Case 4
                Me.picChicagoBears.Image = My.Resources.Symbol


                intCounter += 1
                If intCounter = 5 Then ' sets intCounter back to 0
                    intCounter = 0
                End If
        End Select
    End Sub


This post has been edited by macosxnerd101: 01 January 2011 - 08:10 PM
Reason for edit:: Please use code tags

Was This Post Helpful? 0
  • +
  • -

#6 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,010
  • Joined: 02-July 08

Re: Images in vb.net

Posted 01 January 2011 - 08:09 PM

You need to move the intCounter outside of the tick event - class declaration, else it looses all value once the event is done. Otherwise that looks fine.
Was This Post Helpful? 0
  • +
  • -

#7 jhaze2435  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 26-September 10

Re: Images in vb.net

Posted 01 January 2011 - 08:24 PM

View Posthawkvalley1, on 01 January 2011 - 07:09 PM, said:

You need to move the intCounter outside of the tick event - class declaration, else it looses all value once the event is done. Otherwise that looks fine.


Thanks for your help it is still not working but I appreciate your willingness to help.
Was This Post Helpful? 0
  • +
  • -

#8 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1030
  • View blog
  • Posts: 4,010
  • Joined: 02-July 08

Re: Images in vb.net

Posted 01 January 2011 - 08:29 PM

Oh yeah move the intCounter reset code out of the last Case. Debug your code and you would have noticed that this part never executed.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrSpeed.Tick
        Dim intCounter As Integer

        Select Case intCounter
            Case 0
                Me.picChicagoBears.Image = My.Resources.Brian_urlacker

            Case 1
                Me.picChicagoBears.Image = My.Resources.Jay_Cutler

            Case 2
                Me.picChicagoBears.Image = My.Resources.Devin_hester_again

            Case 3
                Me.picChicagoBears.Image = My.Resources.Devin_Hester
            Case 4
                Me.picChicagoBears.Image = My.Resources.Symbol
    'it was here and if intCounter was not 4 you could not reset the variable
              
        End Select
    'this part is now out of the Select Case
        intCounter += 1
        If intCounter = 5 Then ' sets intCounter back to 0
          intCounter = 0
        End If

 End Sub

This post has been edited by hawkvalley1: 01 January 2011 - 08:30 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1