# Concentration game - how to use the multiple timers

Page 1 of 1

## 11 Replies - 891 Views - Last Post: 15 March 2012 - 06:51 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=270632&amp;s=ff5b5f9deaefc99dbe3e8d4de60df582&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 NessValdez

Reputation: 3
• Posts: 70
• Joined: 12-March 12

# Concentration game - how to use the multiple timers

Posted 12 March 2012 - 07:58 PM

In my class, we are designing a concentration game. The game will give you and output of numbers and you will have a specified time to memorize the numbers. Then, you will enter your guess to see if you were right or not. User will have the option to specify if they want a 3, 6, 12, or 24 digit number. Then they will be able to specify their own timer of 30 seconds, 15 seconds, 3 seconds, or 1 second. The options are done using radiobuttons. Groupbox 1 categorizes the number of digits long. Groupbox 2 is for the timer. So far, I have the whole game layed out except for the timer. Everything works.

How would I go about assigning timers to radiobuttons? If you need the rest of my coding that I have so far, I can paste the coding here tomorrow. I used if and then statements for the radiobuttons in groupbox1...

Is This A Good Question/Topic? 1

## Replies To: Concentration game - how to use the multiple timers

• D.I.C Regular

Reputation: 40
• Posts: 434
• Joined: 08-January 12

## Re: Concentration game - how to use the multiple timers

Posted 12 March 2012 - 08:39 PM

Seriously you need to go read your book also our rules state that you must post your code to receive help. I know just from what you described that you have not read about groupboxes and how they relate to radio buttons. Also when you said that you plan to use the other groupbox for a timer that makes no sense. You are only hurting your self by not learning....
Btw this is the basics, how far do you think you will make it if you don't read your assignments, when you get to harder code.

The timers are used to decide how long the memory numbers should be displayed.
One timer may display the other may turn it off.

When you post your code make sure to use code tags

This post has been edited by Toadill: 12 March 2012 - 08:46 PM

### #3 maj3091

• D.I.C Lover

Reputation: 324
• Posts: 1,924
• Joined: 26-March 09

## Re: Concentration game - how to use the multiple timers

Posted 13 March 2012 - 01:13 AM

NessValdez, please appreciate that not everyone's first language here is English and that what you have written could be misinterpreted, especially where you state about using Groupbox 2 for timers, so it is a little ambiguous. The reason Toadill has a reputation of 24 is because they're an active member of the community and provided valuable help to many people. So please, just chill out, as abusing people isn't the right way to go about getting some help.

Right, that aside.....

If you're putting radio buttons in groupbox 2 for timers, then I would just use the value you have assigned to the radiobutton and use that as the timer interval (you will probably need to do a calculation as the timer works in milliseconds), alternatively, store the actual calculated number in the Tag property of the radiobutton.

Doing it that way, will mean you only need one timer.

Hope that gives you some pointers.

This post has been edited by maj3091: 13 March 2012 - 01:25 AM

### #4 BobRodes

• Lovable Curmudgeon

Reputation: 594
• Posts: 3,055
• Joined: 19-May 09

## Re: Concentration game - how to use the multiple timers

Posted 13 March 2012 - 07:01 AM

Valdez, you get a red card. I've also hidden your post, otherwise you would probably get a few more red cards. You have no business being rude to anyone who is trying to help you. Please refrain from this sort of childishness in future.

As for you, Toadill, you can be a little slower to criticize. Please show me documentation about your "group box" concept, for example. Notice also that the OP did offer to post his code. Perhaps in future you can give a person the benefit of the doubt until it's clear that they are out of line.

Now, to answer your question, or to begin to, you only need one timer, not one for each radio box. Your idea is analogous to saying that you need a different stopwatch for each runner at a meet. You don't, of course. Chew on that and post back if you need to.

This post has been edited by BobRodes: 13 March 2012 - 07:06 AM

### #5 NessValdez

Reputation: 3
• Posts: 70
• Joined: 12-March 12

## Re: Concentration game - how to use the multiple timers

Posted 14 March 2012 - 01:59 PM

Here is my code thus far:

```Public Class Form1
```

``` Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
TextBox1.Text = CStr(Int(Rnd() * 901) + 99)
TextBox1.Text = CStr(Int(Rnd() * 900001) + 99999)
TextBox1.Text = CStr(Int(Rnd() * 900001) + 99999) + CStr(Int(Rnd() * 900001) + 99999)
TextBox1.Text = CStr(Int(Rnd() * 900001) + 99999) + CStr(Int(Rnd() * 900001) + 99999) + CStr(Int(Rnd() * 900001) + 99999) + CStr(Int(Rnd() * 900001) + 99999)
End If

End Sub
```

``` Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Msg As String

If (TextBox2.Text = TextBox1.Text) Then
Msg = "You are correct! "
Else
Msg = "Sorry. Wrong answer. "
End If
MsgBox(Msg)
End Sub
```

```Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

SetTimer(30)
SetTimer(15)
SetTimer(5)
SetTimer(1)
End Sub]
```

Sorry. Not sure what happened to the coding in the last post, but here is where I really need help on:

```Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

SetTimer(30)
SetTimer(15)
SetTimer(5)
SetTimer(1)
End Sub
```

If I only need 1 timer, then this should be a good start. But I dont know where to go from here. And no, my textbook only shows how to use timers set to a password. So this to me is going above and beyond what we have learned.

### #6 MaherD

Reputation: 1
• Posts: 17
• Joined: 14-March 12

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 12:26 AM

just you can set the timer interval to set the time.
you can use something like that
```
timer1.interval = 30000
timer1.interval = 15000
'etc

```

```private sub timer1_timer()
'hide the textbox or do watever you like
end sub

```

• Saucy!

Reputation: 6237
• Posts: 24,002
• Joined: 23-August 08

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 04:34 AM

Some nerve giving our helpful readers crap when you can't even post in the right forum (guess you can't read, huh?).

Now that you've bothered to POST your code, we can all see this is VB.NET, which is NOT VB6.

Moved to VB.NET.

### #8 NessValdez

Reputation: 3
• Posts: 70
• Joined: 12-March 12

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 04:34 PM

• MrCupOfT

Reputation: 2294
• Posts: 9,531
• Joined: 29-May 08

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 04:54 PM

NessValdez: Welcome the real world, where most don't give a flying fork about you.

Be the way I also think what you wrote is rude to all of the members that have taken time out of their free-time to write a post. All you do is slap them in the face. Do you think that will ingratiate them into help you further? If it where me I think twice about assisting you further or make up wait a lot longer. We can always find other members that are more appreciative of the help.

And if you think this is rude, then you have a lot to learn about the internet and some of the people it attracts. The relative anonymity of black text on a white black background, is very appealing and can open up peoples true feelings on a subject.

By the way.

Hello, I'm Adam and welcome to Dream.In.Code.

This post has been edited by AdamSpeight2008: 15 March 2012 - 05:13 PM

### #10 Shane Hudson

• D.I.C Technophile

Reputation: 344
• Posts: 1,286
• Joined: 06-December 09

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 06:07 PM

NessValdez, on 15 March 2012 - 11:34 PM, said:

They were not being rude, you should read the massive big yellow and red boxes at the top of the reply page before posting.

### #11 trevster344

• The Peasant

Reputation: 224
• Posts: 1,519
• Joined: 16-March 11

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 06:14 PM

Well hello there sir/ma'am. Let's start from the beginning shall we? What is the very first thing you want to learn to accomplish for your concentration game(be specific, there is plenty to go over I assure you)?

This post has been edited by trevster344: 15 March 2012 - 06:15 PM

### #12 NessValdez

Reputation: 3
• Posts: 70
• Joined: 12-March 12

## Re: Concentration game - how to use the multiple timers

Posted 15 March 2012 - 06:51 PM

Ive read everything before I posted. But thank you Shane, I did read those massive red and yellow boxes. And I clicked on VB6 purposely. If you couldnt tell, I am new to computer programming. I don't know the difference from VB6 to VB.net because I am still learning. And thats ok. Its only my first semester programming. But I would have to kindly disagree. I think they were being a little rude. And yes, thank you adam. I am aware of the kind of people the internet attracts. Who knew apologizing would make more controversy. Thank you BobRodes for looking at the post fairly. Like I said, I should have commented in a better way. But now I think you guys are taking this too far. It shouldnt have been dragged out. You can delete this forum. Thank you everyone who did take the time to help me.

Page 1 of 1

 .related ul{list-style-type:circle;font-size:12px;font-weight:bold;}.related li{margin-bottom:5px;background-position:left 7px!important;margin-left:-35px;}.related h2{font-size:18px;font-weight:bold;}.related a{color:blue;}