Voici deux exemples pour copier les lignes depuis Richtextbox1 vers Textbox1 ;
1)
Copier lignes récursivement depuis Richtextbox1 vers Textbox1
Dim line As String
For Each line In Me.RichTextBox1.Lines
Try
If Me.TextBox1.Text.Length < 1 Then
Me.TextBox1.Text = line
Else
Me.TextBox1.Text = Me.TextBox1.Text & System.Environment.NewLine & line
End If
Catch ex As Exception
MsgBox("Ligne vide !")
End Try
Next
2)
Copier une ligne définie sur "Textbox2" donc depuis Richtextbox1 vers Textbox1
Dim i As Integer
i = System.Convert.ToInt32(TextBox2.Text) - 1
Try
If Me.TextBox1.Text.Length < 1 Then
Me.TextBox1.Text = Me.RichTextBox1.Lines.GetValue(i)
Else
Me.TextBox1.Text = Me.TextBox1.Text & System.Environment.NewLine & Me.RichTextBox1.Lines.GetValue(i)
End If
Catch ex As Exception
MsgBox("Ligne est vide !")
End Try
Salutations
naim1970