none
Counter RRS feed

  • Question

  • Hi, i am struggling with my counter for a piece of work i am doing, my counter is in the format of x/x and counts up to six perfectly fine (6/6), however i want the second digit in the counter to go up one every time the first digit goes up one when it reaches 6, for example 4/6, 5/6, 6/6, 7/7, 8/8.

    my code is as follows;

    Dim ButtonSubmitCount As Integer
    Dim ButtonSubmitCount2 As Integer

    ButtonSubmitCount2 = 6
    ButtonSubmitCount += 1
                Label6.Text = "Current count = " & ButtonSubmitCount & "/" & ButtonSubmitCount2
                If ButtonSubmitCount = "6" Then
                    MessageBox.Show("Thank you for your time")
                End If

            If ButtonSubmitCount <= "6" Then
                ButtonSubmitCount2 = 6 + 1
            End If

    Thank you for your help,

    Matt

    Friday, May 19, 2017 7:28 PM

All replies

  • This sounds like a class assignment type of thing. Please be aware that if someone gives a complete answer and you use it and your teacher sees this question and the answer then it could be bad for you.

    It is not clear to me what the program is supposed to do. If I understand then you can have a loop inside another loop to get you to 6/6 and then another loop to go from there. What you currently have looks very incomplete; I suggest thinking about it some more and then posting something closer to what you need.



    Sam Hobbs
    SimpleSamples.Info


    Saturday, May 20, 2017 12:20 AM
  • Hi Matt,

    I will move it to VB forum for you to get a quick answer.

    Best regards,

    Fletch


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 22, 2017 2:12 AM
  • however i want the second digit in the counter to go up one every time the first digit goes up one when it reaches 6, for example 4/6, 5/6, 6/6, 7/7, 8/8.

    I can't see how that code works properly up to 6, but I think you want something like:

            If ButtonSubmitCount < 6 Then
                 ButtonSubmitCount += 1
            Else 
                 ButtonSubmitCount += 1
                 ButtonSubmitCount2 += 1
            End If


    • Edited by Acamar Monday, May 22, 2017 6:24 AM
    Monday, May 22, 2017 5:44 AM