[Help]Case in order?

Posts 1–15 of 23 · Page 1 of 2
[Help]Case in order?
Okay I'm making a program off the Keygen source, well it keeps picking the cases randomly.

I have a random button then a "In order" button where it plays case's 0-100 in order. . .but I can't seem to get it to work. . .

What would I do to make it play it in order?


+thanks +rep



Thanks :P
"Case" as in

Code:
Select case {statement}
        Case {statement.attribute}
End Select
yes its like:

Private Sub GenerateRandomly_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GenerateRandomly.Click
Dim Key As Integer
Key = Int(Rnd() * 100)
Select Case Key
Case 0
Saying.Text = ""
Number.Text = "#1"
Case 1
Saying.Text = ""
Number.Text = "#2"
Case 2
Saying.Text = ""
Number.Text = "#3"

and so on but I have another button which I want it to show it in order 0-100


Like the fist click it shows case 0 then case 1 on next click liek that
Then don't use a random number to find them, are you selecting cases from a timer or a do-loop?

Either way the process is similar.

[php]
Dim Key As Integer
Key = 0

Do

Select Case Key
Case 0
Saying.Text = ""
Number.Text = "#1
Case 1
Saying.Text = ""
Number.Text = "#2"
Case 2
Saying.Text = ""
Number.Text = "#3"
End select

Key += 1

Loop
[/php]

Just loop through the cases adding 1 to key each time.
why would you want to use case, That is a horrible! way of doing this
Quote Originally Posted by [code] View Post
why would you want to use case, That is a horrible! way of doing this
Well it depends on exactly what he's using cases for, if he's using it for the way he used it in the example then yes, it's a bad method. However, not knowing his exact context I just answered his question.


Quote Originally Posted by [code] View Post
why would you want to use case, That is a horrible! way of doing this
Well it depends on exactly what he's using cases for, if he's using it for the way he used it in the example then yes, it's a bad method. However, not knowing his exact context I just answered his question.
id say, use an array...
Quote Originally Posted by Beaverman View Post
id say, use an array...
Mhmm, but if there was no pattern or precedent from which to add the 100 items to the array, it would take almost as long to add each individual item as it would to do 100 cases.
Okay I'm trying to make a template for facts, click the button it shows a random fact. It actually gonna be more then 100 but yeah. . .Long term project. Below is how I made the random button fact show which jsut shows the facts randomly.

Code:
Private Sub GenerateRandomly_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GenerateRandomly.Click
        Dim Key As Integer
        Key = Int(Rnd() * 100)
        Select Case Key
            Case 0
                Saying.Text = ""
                Number.Text = "#1"
            Case 1
                Saying.Text = ""
                Number.Text = "#2"
            Case 2
                Saying.Text = ""
                Number.Text = "#3"
I wanna make a button when clicked it shows the fact in the textbox (Saying.Text) and what fact number it is (Number.Text), but in order, from 1-the last one and when at the last it justs restarts 1-last one.

How would I do that?
Quote Originally Posted by Web-Designer View Post
Okay I'm trying to make a template for facts, click the button it shows a random fact. It actually gonna be more then 100 but yeah. . .Long term project. Below is how I made the random button fact show which jsut shows the facts randomly.

Code:
Private Sub GenerateRandomly_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GenerateRandomly.Click
        Dim Key As Integer
        Key = Int(Rnd() * 100)
        Select Case Key
            Case 0
                Saying.Text = ""
                Number.Text = "#1"
            Case 1
                Saying.Text = ""
                Number.Text = "#2"
            Case 2
                Saying.Text = ""
                Number.Text = "#3"
I wanna make a button when clicked it shows the fact in the textbox (Saying.Text) and what fact number it is (Number.Text), but in order, from 1-the last one and when at the last it justs restarts 1-last one.

How would I do that?
I already told you if you'd read .

Where are you getting these facts from? Because an array might actually be applicable here and save you a tonne of coding.
. . .its gonna be off different web site. . .just random facts.

But if theres some way to do it easyier Im open to it
Quote Originally Posted by Web-Designer View Post
. . .its gonna be off different web site. . .just random facts.

But if theres some way to do it easyier Im open to it
Yes I know but can you link to where you're getting the facts from, if I can see exactly how that's structured I may be able to extract each fact to an array with only a few lines of code.
yes okay well I'm gonna be getting everything off didyouknow.org
Quote Originally Posted by Web-Designer View Post
yes okay well I'm gonna be getting everything off didyouknow.org
Fast facts or regular facts?
Posts 1–15 of 23 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?