Problem with programming RRS feed

  • Question

  • Sorry, my English is not so good, but i will try to explain my problem.

     So, I had just two days ago Visual Basic 2010 download. And I started to make  a simple program. Everything works but I want my cases come in a proper order. (So first test 1, then test 2, then test 3 and then test 4)

    Here I am already begun:

    Dim key As Integer
                key = (Rnd() * 4)
                Select Case key
                    Case 1
                        TextBox1.Text = "test 1"
                    Case 2
                        TextBox1.Text = "test 2"
                    Case 3
                        TextBox1.Text =  "test 3"
                    Case 4
                        TextBox1.Text =  "test 4"
                End Select
            End If
        End Sub

    Hopefully you can help me,


    Thursday, December 12, 2013 1:59 PM

All replies

  • Hi Ruben,

    I'm afraid that you knock at the wrong door. This a forum dedicated to Project Server issues and questions.

    You should post your thread to the appropriate forum in order to have a proper support.


    Guillaume Rouyre - MBA, MCP, MCTS

    Thursday, December 12, 2013 2:02 PM
  • Ruben,

    Guillaume is right in that this is not the correct forum for your question. I suggest you find a forum dedicated to Visual Basic.

    However, just to give you a starting point I see a problem with your code that you should address. The "key" variable is calculated as a random number x 4. Depending on the "seed" number (i.e. Rnd(seed)), the result for the key variable will most likely never be an integer number. Further, the probability of the Case value occurring in a sequence of 1,2,3 and 4 is even slimmer.

    So, review the syntax for the Rnd function, the syntax for the Select Case statement, and then post to the correct forum if you still have a question.


    Thursday, December 12, 2013 4:25 PM