[HELP] Text Change

Posts 1–10 of 10 · Page 1 of 1
[HELP] Text Change
ok so this is quite complicated, i hope you get what i mean...
I Have a basic spammer with 2 buttons, Stop and Start

When they press start, i want the button text to say " Spam Started "
And when they press stop, " Spam Stopped "

Here is my code so far:


Public Class Form1

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        Dim SAPI
        SAPI = CreateObject("sapi.spvoice")
        SAPI.Speak("Thanks for using")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Enabled = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox2.Text)
        SendKeys.Send("{Enter}")
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = Timer1.Interval
    End Sub
End Class
button1.text = "Spam started"

complicated? lulz.
Quote Originally Posted by Golden. View Post
ok so this is quite complicated, i hope you get what i mean...
I Have a basic spammer with 2 buttons, Stop and Start

When they press start, i want the button text to say " Spam Started "
And when they press stop, " Spam Stopped "

Here is my code so far:


Public Class Form1

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        Dim SAPI
        SAPI = CreateObject("sapi.spvoice")
        SAPI.Speak("Thanks for using")
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Enabled = False
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox2.Text)
        SendKeys.Send("{Enter}")
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = Timer1.Interval
    End Sub
End Class
Assuming that you use Button1 for starting and stopping spam:

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button1.Text="Spam Started" Then
Button1.Text = "Spam Stopped" 
'Spam stopped code here !!!
Else
'Spam started code here !!!
Button1.Text="Spam Started"
End If
End Sub
wow fk me, never thought of that xD
Cheers!
People, if you have intellisense, Use it
now i have another problem, ( i dont wanna start a new thread, its spamming :P )

I Found this code:
Dim SAPI
SAPI = CreateObject("sapi.spvoice")
SAPI.Speak("Text here")

Which makes it say whatever, its pretty cool xD
But when it starts, it will keep repeating, how do i make it do it just 1 time?!
Quote Originally Posted by Golden. View Post
now i have another problem, ( i dont wanna start a new thread, its spamming :P )

I Found this code:
Dim SAPI
SAPI = CreateObject("sapi.spvoice")
SAPI.Speak("Text here")

Which makes it say whatever, its pretty cool xD
But when it starts, it will keep repeating, how do i make it do it just 1 time?!
Here's the modified code:

Code:
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        Dim SAPI
        SAPI = CreateObject("sapi.spvoice")
        SAPI.Speak("Thanks for using")
    End Sub
Code:
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Enabled = False
    End Sub
Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        SendKeys.Send(TextBox2.Text)
        SendKeys.Send("{Enter}")
Timer1.Stop()
Timer1.Enabled=False
    End Sub
If you want to just send it once, then try just adding the Timer1 code to Button 1. That'll work too !! Anyways, this is a solution too !!
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = Timer1.Interval
    End Sub
Wouldn't the program crash if someone put in like "abc" in the textbox?

Your problem isn't complicated at all.

When you click button 1, Timer1.Start - Button1.Text = "Spamming!"
When you click button 2, Timer1.Stop - Button1.Text = "Idle!"

Just change the text to what you want. (Button1 is Start, Button2 is Stop)
Quote Originally Posted by MugNuf View Post
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = Timer1.Interval
    End Sub
Wouldn't the program crash if someone put in like "abc" in the textbox?

Your problem isn't complicated at all.

When you click button 1, Timer1.Start - Button1.Text = "Spamming!"
When you click button 2, Timer1.Stop - Button1.Text = "Idle!"

Just change the text to what you want. (Button1 is Start, Button2 is Stop)
Yeah, thats a problem i know and will work on later..
But answer my above question ^^ :P
Or just add a label and add this to the Start button:

Label1.Text = "Spam Started!"

and for Stop button:

Label1.Text = "Spam Stopped!"
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us