Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

textbox - array - replace - sendkey

$
0
0
Code:

    Dim newstr() As String = {"{!}", "{%}", "{/}", "{{}", "{}}"}
    Dim oldstr() As String = {"!", "%", "/", "{", "}"}
    Dim notreplaced As String
    Dim text1 As String
    Dim x As Integer = Nothing
    Dim i As Integer = 0
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

    End Sub



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

        For num As Integer = 0 To oldstr.Length - 1

            text1 = notreplaced.Replace(oldstr(num), newstr(num))
           
            notreplaced = text1
        Next
        SendKeys.Send(text1)
        SendKeys.Send("{enter}")
        'MessageBox.Show(spamtext)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Start()
        notreplaced = TextBox1.Text
    End Sub

If I write into textbox '%', it will be replaced with '{%}', and the problem is, that '{' '}' will be replaced with '{{}' and '{}}'...

May someone help me... any idea for a better code, that wouldn't 'make' problems at the end? xd

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>