• Log in or sign up for an account here: https://www.sythe.org/login

[QUES]Sending multiple textbox lines

  • Thread starter Thread starter Soul Undead
  • Start date Start date
S

Soul Undead

Guest
[QUES]Sending multiple textbox lines
Ok, so I am making an auto talker.
I easily managed to get it to send one line from a textbox.
My problem is, I want it to send from 3 text boxes.

here is my code:

timer1
Code:
        SendKeys.Send(RichTextBox2.Text)
        SendKeys.Send("{enter}")

Button that starts:
Code:
        RichTextBox2.SaveFile("C:\logs.txt")
        Timer1.Interval = TextBox1.Text
        Timer1.Enabled = True
        ToolStripStatusLabel1.Text = "Started!"
        ToolStripProgressBar1.Value = "100"
        ToolStripProgressBar1.ToolTipText = "Displays if it is activated or not"

Button that stops:
Code:
Timer1.Enabled = False
        ToolStripStatusLabel1.Text = "Stopped!"
        ToolStripProgressBar1.Value = "0"

I have it set to richtextbox as the message, as it creates a log.
But I would use either: Rich or regular textbox.

If I were to add 2 more textboxes, how would I get them to send all of them, instead of just the first line?
 
[QUES]Sending multiple textbox lines
Code:
    Private Sub Send_Multiline(ByVal txt As String)
        Dim lines() As String = Split(txt, vbNewLine)
        For Each line As String In lines
            ' do stuff here
            MsgBox(line)
        Next
    End Sub
 
[QUES]Sending multiple textbox lines
so you want to have text from 3 textboxes in a log file on 3 lines?
do textbox1.text + chr(13) + textbox2.text + chr(13) + textbox3.text + chr(13)

char 13 is the enter key
Using what programmers call "Magic Numbers" is not recommended. When programmers tend to use number codes that people may not understand, they first declare the number as a constant at the beginning of the code file with a relevant name. I would recommend creating a constant called "CHAR_ENTER" or something similar, with the value 13. You could then use the following code:

Code:
'Beginning of code file
Public Const CHAR_ENTER As Integer = 13
'...
'...
chr(CHAR_ENTER)

Makes more sense, doesn't it?
 
[QUES]Sending multiple textbox lines
so you want to have text from 3 textboxes in a log file on 3 lines?
do textbox1.text + chr(13) + textbox2.text + chr(13) + textbox3.text + chr(13)

char 13 is the enter key
Actually, it just writes to it, so it can remember the last message sent. Although it comes out as

Code:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
\viewkind4\uc1\pard\f0\fs17\par
}

I sent something random while testing it.
 
Runescape Gamblingrunescape gambling
Back
Top