11 Replies - 477 Views - Last Post: 15 March 2012 - 06:51 PM
#1
Concentration game - how to use the multiple timers
Posted 12 March 2012 - 07:58 PM
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...
Replies To: Concentration game - how to use the multiple timers
#2
Re: Concentration game - how to use the multiple timers
Posted 12 March 2012 - 08:39 PM
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
Re: Concentration game - how to use the multiple timers
Posted 13 March 2012 - 01:13 AM
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
Re: Concentration game - how to use the multiple timers
Posted 13 March 2012 - 07:01 AM
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
Re: Concentration game - how to use the multiple timers
Posted 14 March 2012 - 01:59 PM
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
If RadioButton1.Checked = True Then
TextBox1.Text = CStr(Int(Rnd() * 901) + 99)
ElseIf RadioButton2.Checked = True Then
TextBox1.Text = CStr(Int(Rnd() * 900001) + 99999)
ElseIf RadioButton3.Checked = True Then
TextBox1.Text = CStr(Int(Rnd() * 900001) + 99999) + CStr(Int(Rnd() * 900001) + 99999)
ElseIf RadioButton4.Checked = True Then
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
If RadioButton5.Checked = True Then
SetTimer(30)
ElseIf RadioButton6.Checked = True Then
SetTimer(15)
ElseIf RadioButton7.Checked = True Then
SetTimer(5)
ElseIf RadioButton8.Checked = True Then
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
If RadioButton5.Checked = True Then
SetTimer(30)
ElseIf RadioButton6.Checked = True Then
SetTimer(15)
ElseIf RadioButton7.Checked = True Then
SetTimer(5)
ElseIf RadioButton8.Checked = True Then
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
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 12:26 AM
you can use something like that
If RadioButton5.Checked = True Then timer1.interval = 30000 If RadioButton6.Checked = True Then timer1.interval = 15000 'etc
private sub timer1_timer() 'hide the textbox or do watever you like end sub
#7
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 04:34 AM
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
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 04:34 PM
#9
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 04:54 PM
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
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
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 06:14 PM
This post has been edited by trevster344: 15 March 2012 - 06:15 PM
#12
Re: Concentration game - how to use the multiple timers
Posted 15 March 2012 - 06:51 PM
|
|

New Topic/Question
This topic is locked



MultiQuote







|