Click here to Skip to main content
15,937,004 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Program that reads from text box 1 one by one the letters and copy it to the text box 2 via text box 3.
I would like that every time that TextBox3 = " " (space) the text box 2 to change the line (press enter key).
VB
Public Class Form1
    Dim ptkati As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        pb1.Maximum = TextBox1.TextLength + 1
        TextBox3.Clear()
        TextBox2.Clear()
        pb1.Value = 0

        For Me.ptkati = 0 To TextBox1.TextLength
            TextBox1.Focus()
            TextBox1.SelectionStart = Me.ptkati
            TextBox1.SelectionLength = TextBox1.SelectionStart - (TextBox1.SelectionStart - 1)
            pb1.Value = pb1.Value + 1
            TextBox3.AppendText(TextBox1.SelectedText)
            TextBox2.Text = TextBox2.Text & TextBox3.Text
            If TextBox3.Text = " " Then
               
'I know that I have to put something right here but I don't what!

            End If
            TextBox3.Clear()
        Next
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = "If you trer ie nearest eollowing code shows examples of roundi trer ie nearest eollowing code shows examples of rounding"
    End Sub
End Class
Posted
Updated 26-Feb-13 1:25am
v3
Comments
André Kraak 26-Feb-13 7:25am    
Please DO NOT SHOUT when asking a question. When you use all capital letters it is seen as shouting on the Internet and considered rude. Next time when posting a question please use proper capitalization.

1 solution

If you just want a newline to be inserted in TextBox2.Text at that point then use
TextBox2.Text += vbCrLf

Remember to make sure that the Multiline property of the text box is set to true.

I'm not sure your code will actually do what you appear to want it to do though
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900