Code Help

basacwards

New member
Joined
May 22, 2013
Messages
3
Programming Experience
Beginner
Hey guys im trying to code a "seemingly easy program" which turns out not to be easy in my understandings. What im tring to do is have 3 Main Buttons (Function/Up/Down) and an image that constantly changes. When the function button is pressed the image will change from XXX to RUN. Once RUN is displayed the middle and right button will then toggle between the other "images" (settings .. like HI LOW MED) ... however your not suppose to be able to toggle the other images UNLESS run was first displayed. .. Please help! I attached a brief image of the controller
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    34.3 KB · Views: 32
I don't follow what you're even asking here.
I think you're wanting to have a couple of buttons be disabled until the function button is clicked, but I'm not sure.
 
I don't follow what you're even asking here.
I think you're wanting to have a couple of buttons be disabled until the function button is clicked, but I'm not sure.

Ok I figured the most part of it out.. what im trying to do now is toggle between 11 images. When I press the up button it changes to image 2 then 3..4.5.. ect.. but if i stop on any of those and press the down button I then want to display the previous image..ect ect.. Kinda like counting up and down but using images instead!
 
Easiest way to do this is to have an integer, the up & down buttons simply increment or decrement the integer variable and when that integer changes you show the appropriate image for the current value of the integer.
 
That sounds exactly like what im trying to do but have no experience with integer and its variables. Could you provide a brief example of what the code would look like to point me in the right direction ?
 
I chose to make an internal property on the form to detect when the integer value changes:
Public Class Form1

    Private m_ImageCounter As Integer = 0I

    Private Property ImageCounter As Integer
        Get
            Return m_ImageCounter
        End Get
        Set(value As Integer)
            'Keep the value within useful range
            If value < 0I Then value = 0I
            If value > 3I Then value = 3I

            If m_ImageCounter <> value Then
                m_ImageCounter = value
                Select Case value
                    Case 0
                        'Set the image for zero
                    Case 1
                        'Set the image for one
                    Case 2
                        'Set the image for two
                    Case 3
                        'Set the image for three
                End Select
            End If
        End Set
    End Property


    Private Sub UpButton_Click(sender As System.Object, e As System.EventArgs) Handles UpButton.Click
        Me.ImageCounter += 1I
    End Sub

    Private Sub DownButton_Click(sender As System.Object, e As System.EventArgs) Handles DownButton.Click
        Me.ImageCounter -= 1I
    End Sub
End Class
 
Back
Top