Hey,
This tut is extremely simple, a good one for C# beginners =)
First create a new C# project by going to
Then add 1 timer, 3 textboxes, and 2 buttons.Code:File>New>C#>Windows Forms Application
First were gonna give your timer a code, double click on your timer and add this code
The SendKeys Function basically types out the text you specify.Code:SendKeys.Send(textBox1.text); SendKeys.Send("{ENTER}"); SendKeys.Send(textBox2.text); SendKeys.Send("{ENTER}"); SendKeys.Send(textBox3.text); SendKeys.Send("{ENTER}");
Now rename one of your buttons to "Start", and give it the following code
This enabled the timer, which in return, starts spamming your text.Code:timer1.Enabled = true;
Then rename another one to "Stop", and give it the code below
This disables your times, which stops the spamming.Code:timer1.Enabled = false;
And ur done =D
How simple was that?
Hope you learned a thing or two from this.
~kierien
Last edited by Kierien; 01-31-2009 at 09:02 PM.
Not bad, perhaps a bit more explanation though? Newbs are not going to know what a timer does or what the SendKeys class is. Perhaps you should give more detail on these two things. Also, don't you need a timer_tick function before your timer1 will do anything?
You have misunderstood. Timer_Tick is the subroutine that runs whenever the timer ticks.
All of this code:
..is put within the timer_tick subroutine.Code:SendKeys.Send(textBox1.text); SendKeys.Send("{ENTER}"); SendKeys.Send(textBox2.text); SendKeys.Send("{ENTER}"); SendKeys.Send(textBox3.text); SendKeys.Send("{ENTER}");
ok, I'm very new, so should I attempt this or not, cause it looks like its incomplete or lacking info...?!
![]()
I tried this, and got some errors at the end of each of the SendKeys.Send(textBox1.text);
the error is:
dosn't contain definition for text and no extension method text.
Did I need a reference that I didn't use?! :S
I don't get it sorry I'm new :$
It's .Text, not .text
I think the IDE will correct that for you.
What does this do?
Like Jordan said, newbs won't understand what this is doing.Code:SendKeys.Send(textBox1.text);
Why? I don't see anywhere in your code, you referencing the button that you want me to call "Start". So why should I?Code:Now rename one of your buttons to "Start"
Yes, you do need a timer_tick method. When you double click on a timer, one is created for you.Alright, will reedit to more detail, and no we dont need a timer_tick, because we already have our timer enabled and disabled via buttons.
yes its true im trying to figure out what its doing, but I guess tomorow mourning would be better... plus you are right .Text was the problem, I did it and I got stuck in the autospamer when I tried it...![]()
First of all, i wanted to rename the button to "Start" so that things will look neater. Secondly, yes i know when i double click on a timer a timer_tick is created for me. But i was referring to Jordan's post on whether a timer_tick was needed before the timer would function. And yeah we would need one, but it's already created anyway.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks